(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Children's Library | Biodiversity Heritage Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "westernDigital :: WD90 Pascal Microengine :: Pascal MICROENGINE RefMan Mar79"

PRICE $19.95 




frrtfip- 



ff"f:".;sft: 



ltf!f('rtt!'i!-i!fr. 



■V! ■-■. ', ■ 




WD/90 

Pascal MICROENGINE 
Reference Manual 



TM 



THE MICROENGINE COHPANY 



tffl 
Pa&cal MICROENGINE Computer 

User's Manual 



Preliminary Edition 
March, 1V79 



Software is provided on a licensed basis only and is the property of the 
University of California with permission granted for use on an individual 
syste* basis only. Copies may be made for archival purposes only. 

Information furnished by The niCROENGIl« Company is believed to be accurate 
and reliable. Hoi^ver, no responsibility is assumed by The MICROENGINE 
Company for its use; nor for any infringements of patents or other rights of 
third parties which may result from its use. No license is granted by 
implication or otherwise under any patent or patent rights of The illCROENGINE 
Company. The HICROENGINE Company reserves the right to change product 
specifications at any time without notice. 



Copyright <c) 1979 bi The mCROENGINE Company 
First Printed rtarch 1979 
All rifi^ts reserved. 



No part of this do<:um£'nt may be reproduced by 
any means> nor trarslated* nor transmitted 
into a machine langucge without the written 
permission of The IIICFOENGINE Company. 

MICROENGINE is a Registered Trademark of 
Western Digital Corporation. 

The niCROENGINE Company is a wholly-owned 
subsidiary of Itestern Digital Corporation. 



PREFACE 



This manual describes the use and operation of the lUCROENGINE Company's 
roir.roco»puter products for developing and executing programs in the Pascal 
language. These products are: 



o the WD/900 Pascal niCROENGIICtm Single-Board Computer, 
an 8 by lA-inch board containing a WD/9000 16-bit 
microprocessor that directly executes UCSD's Pascal P- 
code» 6^ bytes of memory, 2 RS-232 asynchronous serial 
ports, 2 8-bit parallel ports, and a Floppy Disk 
Controller; and 

o the WD/90 Pascal HICROENGIIC Computer, a desktop 
microcoj^uter comprised of a Pascal I1ICR0ENGINE Single- 
Board Computer and power supplies enclosed in a 
stylized housing. 

The manual is intended to serve both as an introductory guide and as a 
reference source. Chapter 1 presents an overview of the computer. It briefly 
describes hardware components of the computer; the software provided with the 
computer; the mechanical, environmental, and electrical requirements of the 
computer; and the computer operation. Chapters 2, 3, and A provide "how-to" 
information: how to install a new computer, how to operate the computer, and 
how to perform troubleshooting procedures. Chapter 5 presents detailed 
information on the computer's operation. 

The software provided with the computer is the Pascal Operating System 
developed at the University of California at San Diego (UCSD). This operating 
system is described in the Pascal III.O Operating System Reference Hanual. 



This manual was prepared and edited using the 
ICSD Pascal Screen Oriented Editor and was 
printed using a PRINTRONIX ilodel P300 
lineprinter. The lineprinter was provided by 
PRINTRONIX Corporation, Irvine, California. 



CONTENTS 

1» OVERVIEW , „ „ 1 

1.1 Coi^onents of the Computer , 1 

1.2 Pascal Operating System „.. 2 

1.3 Requirements of the Computer 3 

1.^ Coo^uter Operation 3 

2. INSTALLATION PROCEDURES 'j 

2.1 Setting Cation Switches 5 

2.1.1 Opening the Computer Housing..,. 5 

2.1.2 Setting the Floppy Disk Controller Option 

Switches '/ 

2.1.3 Setting the System Terminal Specifications 

Switches , 8 

2.1.4 Setting the Serial Port Baud Rate Switches 10 

2.1.5 Rec losing -ttie Computer Housing 10 

2.2 Installing System Components , 11 

2.2.1 Installing the Computer 11 

2.2.2 Connecting the Peripherals 11 

2.2.3 Plugging in the Power Cord „ 12 

3. OPERATING PROCEDURES , 13 

3.1 Starting and Stepping the System ., 13 

3.1.1 Turning On the Power 13 

3.1.2 Loading the System Software i^q 

3.1.3 Stopping the System „ 1/) 

3.2 Changing Hardware Option Switch Settings i«i 

4. TROUBLESHOOTING PROCEDURES , 17 

A.l The Troubleshooting Process; A General Discussion 17 

4.2 Symptom 1: Operating System Fails to Announce Itself IB 

4.2.1 Repeating the Software Loading Procedure 18 

4.2.2 Checking the Floppy Disk Controller Option 

Switches 18 

4.2.3 Measuring and Adjusting the Power Supplies 17 

4.3 Symptom 2: Transfers to the System Terminal Fail 20 

4.4 Symptom 3: Transfers to the Parallel Ports Device or 

Floppy Disk Fail 21 

4.5 Syu^toffl 4; System Fails to Pass Diagnostic Program 21 

4.6 The Troubleshooting Process: a Summary Flow Chart 

5. THEORY OF OPERATIONS 25 

5.1 Processor /Memory and Processor /Peripherals Communication....... 25 

5.1.1 Processor /Memory Communication 28 

5.1.2 Processor-Initiated Communication with Peripheral 
Devices. , 28 

5.1.3 Device-Initiated Communication with the Processor 
Interrupts. ........................................... 29 

5.2 Pascal MICRCENGINE Processor , 30 

5.3 Memory. 31 

5.4 Serial Ports 31 



5.A.1 Default Operation of the Serial Ports » 33 

5.^.2 Device Programwinij McchaniBm: the Control Regi&ter&. ...... 37 

5.5 Parallel Ports ,. - -^3 

5.5.1 Default Operation of the Parallel Ports 43 

5.5.2 Device Programming Mechanism: the Control Register...... 46 

5.6 Floppy DisN Controller and DMA Controller............ 4V 

5.6.1 Start-Up Procedures. Involving the D11AC and FDC.... - 51 

5.6.2 Proce55or-Initi.3tBCl Communication uiith the DHAC and FDC. 51 

5.6.3 DMA Controller Orgeinization and Operation 53 

5.6.4 Floppy Disk Controller Organization and Operatic? 59 



ILLUSTRATIONS 



Fit/ure 
Nufi*er Title 



1-1 



Pascal niCROENGINE Computer 



2-1 
2-2 
2-3 
2-4 
2-5 

3-1 

4-1 
4-2 
4-3 



Removing the Rear Panel ..... 

Removing the PC Board ....... 

Location of the Option Switch Packages 

Air Uents 

Rear Panel 



ON/OFF Switch 



5 

5 

6 

11 

11 

13 

IV 
17 



RESET Button Location 

Locations of the Power Si^plie 

Pleasuring and Adjusting a Pouier Supp ly - 20 

Fault-Finder Flow Chart ..................;,...... 22 



5-1 Pascal PIICROENGINE Computer Components 26 

5-2 Default Parallel Port Control [Register Values.... .-« 4B 

5-3 Format of First Data Word Transmitted to the FDC 53 



T^LES 



Tab le 

Number Title 



2-1 
2-2 
2-3 
2-4 

5-1 
5-2 
5-3 
5-4 
5-5 
5-6 



Floppy Disk Controller Option Switch Settings 7 

Standard System Terminal Sttiitch Settings 

System Terminal Specifications Switch Settings V 

Serial Port Baud Rate Switch Settings 10 

Communication Bus Structure Control Lines 27 

Standard General Device Addresses - 29 

Interrupt Conditions and Vector Addresses 30 

Serial Port Cable Connector Pin Assignments ^ 32 

Ser ia 1 Port Addresses. 34 

Serial Port Status Register Contents.. 35 



5-7 Serial Port Control Register 1 Contents.,. ........,...„.„ 37 

5-8 Serial Port Control Register 2 Contents m 

5-9 Serial Port SYN, DLE, and Control Register Addresses.... ^2 

5-10 Parallel Port Cable Connector Pin Assignments m 

5-11 Parallel Ports Control Lines (Port C)...., /|5 

5-12 Parallel Ports Addresses „ /16 

5-13 Parallel Ports Control Register Contents ^7 

5-1-^ Floppy Disk Cable Connector Pin Assignments... 50 

5-15 DWAC/FDC Addresses 52 

5-16 DUAC Control Register Contents 5^ 

5-17 DHAC Status Register Contents „ 55 

5-18 Stepping flotor Rates for FDC Type I Commands 59 

5-19 FDC Command Register Values for Type I Commands... 60 

5-20 FDC Status Register Contents for Type I Commands 61 

5-21 FDC Command Register Values for Type II Commands 63 

5-22 FDC Command Register Values for Type III Commands.. 6A 

5-23 FDC Status Register Contents for Type II and Type III 

Commands. ....«...............,.,,,..,,...,..... 6A 

5-24 FDC Command Register Values for the Force Interrupt Command 

<Type IV) 65 



1. OVERVIEW 

The UD/90 Pascal illCROENGIWE Computer is a desktop microcomputer for 
developing and executing programs in the Pascal language. Figure 1-1 shows the 
outward appearance of the computer. 







Figure 1-1. UD/90 Pascal HICROENGINE Computer 

To create a complete computer system, the user need only add a system 
terminals floppy disk drive* and any other desired I/O peripheral devices. 

This introductory chapter provides an overview of the hardware 
components of the computer; the software provided with the computer; the 
mechanical* environmental* and electrical requirements of the computer; and 
the computer's operation. Subsequent chapters describe procedures for using 
the computer and also provide detailed information on the operation of the 
computer and its components. 



1.1 



COMPOhENTS OF THE COMPUTER 



The UD/90 Pascal HICROEHGINE Computer is driven by Western Digital's UD/9000 
Pascal illCROENGINE chip set* a stack -oriented 16-bit processor that directly 
executes UCSD's Pascal P -code. The processor and the other hardware 
components of the computer are on an 8 by 16-inch board enclosed in a low- 
profile (5-1/4 by 16-1/-^ by 13-1/2 inch) stylized housing. 



Page 1 



The m/9000 processor is a hardware realization of UCSD's pseudo P-machine- 
The processor is coaprised of fivt? LSI/PIOS circuits, each contained in a 40- 
pin package. The individual circuit*-, are: 

D The Data Chip* containing the fliicroinstruction d^oder, 
the arithmetic and logic unit <W-U), and the register 
file. 

o The Control Chip» containinci the macroinstruction 
decoder. portions of the control circuitry* the 
microinstruction counter, and input/output control 
logic. 

o Three 22 by 512-bit niCROTI chifs, containing processor 
microinstructions. 

The processor uses A po»er supplies (+1!>V, +12V» -12V; and -5V) and runs off a 
3 VMz clock signal that is suladivided into A nonover lapping phases (75 
nanoseconds per phase). All I/O signals are compatible »ith transistor- 
transistor logic (TTL). 

In addition to the five processor cldipjw the board contains: 

o 6^ bytes <32K words) of randon-access memory (RAPI). 

o Two RS-232 asynchronous serial ports with switch- 
selectable baud rates from 110 to 19,200 bits per 
second. 

o Two 8-bit parallel ports. 

o A Floppy Disk Controller that :ts switch-selectable for 
single or double-density 5-1/A or 8-inch floppy disks 
and which can control up to 4 drives of the same type. 
The Floppy Disk Controller operates under control of 
the Direct lienor y Access Controller. 

1.2 PASCAL OPERATING SYSTEM 



The software provided with the Pascal IHCRQENGINE Cwi^uter is the Pascal 
t^erating System developed at the University of California at San Diego 
(UCSD). This operating system includes: 

o A Pascal Compiler. 

o A BASIC Compiler. 

o A File nanager. 

o A Screen-Oriented Text Editor. 

o A Debugging System. 



Pa^e 2 



The operating system is available in any of the following forms: 

o One 8-inch single-density floppy disk, 

o One 8-inch doui> le-density floppy disk. 

o T«»o 5-1/4-inch single-density floppy disks. 

o Two 5-1/4-inch double-density floppy disks. 

Chapter 3 of this manual describes the procedures for loading the operating 
system into the computer. Complete information of the use of the operating 
system is provided in the Pascal III.O Operating System Reference Manual. 

1.3 REQUIREMENTS OF THE COMPUTER 



The Pascal MICROENGIhE Computer has a straight forward set of easily satisfied 
requirements: 

o The cofl^uter requires a flat, hard surface to hold the 
board enclosijre, u»hich is 5-1/4 inches high> 16-1/4 
inches wide, and 13-1/2 inches deep. 

o The computer can operate in temperatures in the range 
0-50 degrees C. HiMidity can range between 0% and 95% 
without affecting the computer's operation. 

o The con^uter normally runs on 110 volts AC. Optionally, 
the user can order a Pascal MICRCENGIhE Computer which 
runs on 220 volts AC. In either case, the line frequency 
range is 48-63 Hz. 

1.4 COMPUTER OPERATION 



Communication between co^onents of the computer — processor, memory, 
peripheral ports, and controllers — is achieved via a processor -controlled 
bus structure. This structure is comprised of an address bus and latch, a 
bidirectional data bus, and several control lines. 

The processor initiates communication with a peripheral device or a location 
in memory by loading the appropriate address onto the address bus. A 
peripheral device can initiate communicaton with the processor by generating 
an interrupt. Memory cannot initiate communication with the processor; all 
processor-memory communication is initiated by the processor. In addition, the 
Floppy Disk Controller operates under control of the Direct Memory Access 
Controller, allowing data transfers between a floppy disk and memory without 
involving the processor. Each of these communication mechanisms is discussed 
in Chapter 5. 



Page 3 



2. 



INSTALLATION PROCEDURES 



When a neu» Pascal I1ICR0ENGINE Computer is received, the first step is to 
unpack the components and verify that all of the items listed on the packing 
slip have been included and are intact. (In the event that any of the 
components are missing or have been damaged in shipping* contact your 
niCROENGINE Company representative immediately.) 

After verifying that the delivery is in order, take the steps outlined in this 
chapter to install the computer. 

2.1 SETTING OPTION SWITCt€S 



The Pascal MIDJOENGINE Computer provides switches for specifying the 
characteristics of the floppy disk containing the Pascal Operating System, for 
providing information about the system terminal, and for selecting the baud 
rate for each of the two serial ports, 

2.1.1 Opening the Computer Housing 



The first step is to open the coo^uter housing. Begin by turning the computer 
on its side with the ON/tFF switch toward the top. (CAUTION: the computer 
housing has sharp edges. Be careful not to scratch your table top.) Remove 
the four screws located on the rear panel as illustrated in Figure 2-1. 



Slide the rear panel and attached PC board about half way out as 
in Figure 2-2. 



illustrated 





Figure 2-1. Removing the Rear Panel 



Figure 2-2. Removing the PC Board 



Page 5 



FLOPPY DISK 
CONTROLLER 
OPTION SWITCHES 
L9 



SYSTEM TERMINAL 
SPECIFICATION SWITCHES 



X14 



XI 6 




1 


2 


3 


4 


5 


6 


7 


8 



Figure 2-3. Location of the Option Switch Packages 



Paije 6 



2.1.2 Setting the Floppy Disk Controller Option SuiitcheB 

Locate the Floppy Disk Controller option siuitch package <cofflponent 
desiignation L9) on the board as Bboviti in Figure 2-3. 

This package contains two switches. Suiitch SI OFF corresponds to single 
density mode, and switch 1 ON corresponds to d<xjble~den5ity mode. Siuitch S2 
OFF corresponds to 8-inch disks, and siuitch 2 ON corresponds to 5-1/^-inch 
disks. 

Set these switches according to the characteristics of the floppy di5k<5) 
containing the Pascal (iterating System. Table 2-1 summarizes the possible 
combinations of disk characteristics and the corresponding option switch 
settings. 



Table 2-1. Floppy Disk Controller Option Switch Settings 



Operating System Resides On; Set SI to: Set S2 to; 



8"inch double-density disk 
8-inch single-density disk 
5-1/4-inch doiA)le-density disks 
5~l/4-inch single-density disks 



ON 


OFF 


OFF 


or-F 


ON 


ON 


OFF 


ON 



Page 7 



2.1.3 Settint) the System Terminal Sptjcifications Switches 



After setting the Floppy Disk Controller option switches* the next step is to 
provide some information about the syitem terminal* i.e-> the terminal to be 
used as t-he vehicle for communication botuteen the computer and the user. ft 
hardware option switch package (Xl^) is provided for supplying this 
information* located as shown in Figure 2-3. 

Eight switches are provided. 

Set these switches according to the cha'^acteristics of the system terminal. 
Table 2-2 outlines the settings for a standard system terminal: Table 2-3 
describes the function of each switch. The controls on the system terminal 
must be set to inhibit parity generation (Operating System constraint). 
Switches S7 and S8 must be set to match the number of bits per character 
generated by the terminal. 



Table 2-2. Standard Syst(?m Terminal Switch Settings 



Switch Setting 



("OFF" or "OPEM") 

("ON" or "CLOSED") 

("ON" or "CLOSED") 

("OFF" or "OPEN") 

Don't i;^re 

("OFF" or "OPEN") 

(Bits per character; must 

aatch setting on terminal.) 



PARITY nUSl BE TURNED OFF AT TERHINAi.. 



SI 


1 


S2 





S3 





S^ 


1 


S5 


- 


S6 


1 


S7 


X 


S8 


y 



Page 8 



Table 2-3. System Terminal Specifications Siuitch Sotting'^ 



Switch Function 



Sl~3 Select the transmit and receive clock: 
S3 S2 SI 

(IX) 












- Transmit and receive clock input ( 








1 


~ Rate 1 (32X) 





1 





- Rate 2 (32X) 





1 


1 


- Rate 3 <32X) 


1 








- Rate A (32X) 


1 





1 


~ Rate ^ - 2 (64X) 


1 


1 





~ Rate 4 - -q <128X) 


1 


.t 


1 


- Rate 4 " 8 (2.'J6X) 


as 


ync 


hrc 


»nou5 mode (switch 6=0)/ controls the 



alternate Receiver clock rate: 

~ Receiver clock rate determined by 

swit-ches 1-3- 

1 - Receiver clock rate ~ Rate 1. 

In synchronous mode (switch 6=1)* controls SYN 
character stripping: 

1 - SYH character stripping enabled. 

- SYN character stripping disabled. 

55 Controls «»hether parity is odd or even: 

1 ~ odd parity. 

- even parity. 

56 Controls the character mode: 

1 ™ synchronous mode. 

- asynchronous mode. 

S7-8 Select the number of bits per character: 
58 S7 
0-8 bits. 

1-7 bits. 

1 0-6 bits. 
1 1-5 bits. 

where: "0" corresponds to "ON" or "CL015ED" 
"1" corresponds to "OFF" or "OPEN" 



Page 9 



2.1.4 Setting the Serial Port Ba'jd Hate Switches 



LcKate the serial port baud rate selec1;ioT» switch package (X16) on the board as 
shown in Figure 2-3„ 

Four switches are provided for each serial port* allowing 16 possible rate 
selections for each port. 

Set the switches Por each serial port i;o the baud rates appropriate to the 
type of device to be connected to tha-i; port. Table 2-A outlines the settings 
for comaon ly-used baud rates. 

Table 2~4. Serial Port Baud Rate Switch Settings 





Switch 


Settings 




Port A 


Port B 


Baud Rate 


;i 


2 


3 


4 


5 


6 7 8 


!>0 




















75 


.1 














1 


110 





1 











1 


13^.5 


"t 


1 











1 1 


150 








1 








10 


300 


.i. 





1 








1 1 


600 





1 


1 








1 1 


1200 


;l 


1 


1 








1 1 1 


1800 


















2000 


\ 












1 


2^0 





1 









1 


3600 


I 


1 









1 1 


^800 








1 






1 


7200 


I 





1 






1 1 


9600 





1 


1 






1 1 


19200 


L 


1 


1 






1 1 1 



where; "0" correspoids to "ON" or "CLOSED" 
"1" correspoids to "OFF" or "OPEN" 



2.1.5 Reclosing the Cofl^uter Housin} 



The computer housing can be reclosed by reversing the steps outlined in 
subsection 2.1.1. Slide the PC boa^d and rear panel back in place and then 
attach the rear panel by replacing the four screws. 



Pflg? 10 



2.2 



IJ^TALLING SYSTEtl COnPOhENTS 



Once the option switches have been set/ the various components of the system 
can be installed. 

2.2.1 Installin^i the Computer 



Place the housing containing the Pascal HICROEHGINE Computer on a fUt, hard 
surface. Be sure that neither the air intake vent nor the air outlet vent is 
blocked. As illustrated in Figure 2~A, The air intake vent is located on the 
bottom panel of the computer housing* and the air outlet vent is located on 
the rear panel. 

Be sure that the computer is located near an electrical outlet, preferably 
within six feet* the length of the power cord- 



AIR OUTLET VENTS 




J4 FLOPPY DISK 

J3 PARALLEL PORT 

J2 SERIAL PORT B 

J1 SERIAL PORTA 



AIR INTAKE VENTS 




ON/OFF SWITCH 
POWER 
CORD CONNECTION 



RESET BUTTON 



Figure 2~A. Air Vents 
2.2.2 Connecting the Peripherals 



Figure 2-5. Rear Panel 



Before connecting any peripheral device to the Pascal niCROENGINt 
Computer* review the documentation provided by the manufacturer of that 
device. Perform the specified inspections and off-line start-up procedures. 

After ccHiqsleting the peripheral device pre-installation inspection and 
verification procedures* locate the port connections on the rear panel of the 
coaputer housing* illustrated in Figure 2-5. 

Connect the floppy disk drive cable to the connection labeled M FLOPPY DISK. 



Page 11 



Ccnnect the cable from the terminal 1 to be used for sye-tem/user commuTmcation 
to the connection labeled Jl SERIAL PORT A. 

If other devices are to be connected to the auxiliary serial port and/or the 
parallel port* connect those cables accordingly. 

When a device is connected to the peripheral ports, the cable connector must 
he wired for either true data or false data. For true data, connect the TUO 
and TDI lines (pins 32 and 9. respectively) to ground <pin /"> . For false 
data, connect TOO and TDI to the ^5 volt supply <pin 26). 

IL2„3 Plugging In the Puu>er Cord 



Next, locate the ON/OFF rocker ssuitch on the rear panel of the computer 
housing, as illustrated in 2"5.. 

BE. SURE THAT THIS SWITCH IS BCT TO OFF. Then.. locate the potuer cord 
connection near the ON/OFF sioitch on t^e rear panel. Plug the system pomer 
cord into this connection. 

If the computer i»as ordered to operate on 110 volts, thc^ power cord is 
deliveied tuith a standard iBall outlet plug attached. If the system u>as 
ordered to operate on 220 volts, the potuer cord is delivered luithout an outlet 
plug- Attach an appropriate plug to the cord. 

After AC pou>er is applied, the system is ready for operation. Operating 
procedures are outlined in Chapter 3. 



Pcig.? 12 



3. 



OPERATING PROCEDURES 



When the Pascal niCROENGINE Computer is properly installed (see Chapter 2), 
operation consists primarily of startinj) and stopping the system. 

3.1 STARTING AND STOPPING THE SYSTEM 



System start-up involves three operations: 

1. Turn on the power. 

2. Load the system diskette into the disk drive. 

3. Depress the RESET button. 
3.1.1 Turning On the Po»uer 



Turn on the power by setting the ON/OFF rocker switch tn OH. The ON/OFF 
switch is located on the rear panel of the computer housing/ as illustrated in 
Figure 3-1. 

The CW/OFF switch lights when set to ON to indicate that the computer is 
receiving power. (If the switch fails to light, make sure that both ends of 
the power cord are plugged in properly. If the switch still fails to light, 
the user can assume that the wall outlet is not supplying power; since the 
switch light is wired directly to the power cord connection.) 



«j*«Me*':«..r¥3i@5!«fl«i|^'!sr».«^4 ^-. 




RESET 
BUTTON 



POWER CORD 
CONNECTION 



ON/OFF SWITCH 



Figure 3-1. ON/OFF Switch 



Page 13 



3.1.2 Loading the System Softwan? 

The software provided ©ith the Pascal MICROENGIhE Computer is the University 
of California at San Diepo (UC3D) Pascal Operating liysteffl. This system 
inclixles: 

o Pascal Compiler 

o BASIC Compiler 

o File Manager 

o Screen -Oriented Text Editor 

o Debugging System 

To load the operating system/ simply load the operating system floppy disk 
into floppy disk drive (0) and depress the RESET button located next to the 
pouser cord connection on the rear panel (see Figure 3-1). 

NOTE: The I1ICR0EHGINE Company recommends that whenever 
the system is started* the steps Just discussed 
be performed in the order described. That is> 
the ON/OFF switch should be set to ON before a 
floppy disk is loaded. 

The operating system announces itself ijnd then generates the line: 

Command: E(dit/ R<un. F(ile, C<omp, L<ink/ X(ecute» ACssem, D(ebug 

to the screen of the system terminal; indicating that the system has been 
loaded successfully and is ready to accept any of the listed commisnds. The 
Pascal III.O Operating System Reference Manual provides con^lete information 
on the user's options at this point. In the event that the command prompt 
line fails to appear repeat the above procedures carefully. If the prompt line 
still fails to appear consult Section '^.2. 

3.1.3 Stopping the System 



At the end of a session with the Pascal tllCROENGINE Computer system* simply 
remove the software floppy disk(E) from the floppy disk drive(5) and set the 
ON/OFF switch to OFF. 

NOTE: The HICROENGINE Company recommends that these 
procedures be performed in this order whenever 
the system is stopped. That is* the floppy 
disk<s) should be removed before the ON/IFF 
switch is set to OFF. 



P.jge 14 



3.2 CHANGING HARDWARE OPTION SWITCH SETTINGS 

Chapter 2 outlines the procedures for setting the Pascal MICRttNGIHE Computer 
hardware option switches as part of the system installation process. <SttiitchRs 
are provided for specifying the floppy disk, system terminal and baud rates 
for the serial ports.) If the user wishes to change these settings, he foUouis 
the same procedures, outlined in Chapter 2. 



Page 15 



A, TRUUBLESHOOTIHG PROCEDURES 

The Pascal illCROENGINE Computer requires no prtjventive mamtenance. This 
chapter outlines procedures that are required only if a problem ari&es tuith 
the operation of the system. 

After a general discussion of the troubleshooting process, this chapter 
describes specific procedures, presented in terms of the "syjnptom" displayed 
by the system. That is, this chapter details the steps to be ttiken if: 

o the Pascal Operating System fails to iinnounce itbeif 
on the system terminal upon loading; 

o data transfers to/froro the system terminal, the lin<? 
printer or other device connected to the parallel 
ports, or a floppy disk fail; or 

o the system exhibits none of the above symptoms but 
operates erratically. 

The last section of this chapter summarizes the total fault -finding procesu 
for a complete Pascal illCROENGINE Computer system, again in flow chctrt form,, 

NOTE: This chapter assumes that each of the system's 
peripheral devices aias thoroughly inspected and tested 
before it u>a5 installed. If this is not the case. The 
niCROEMGINE Company strongly recommends that the user 
perform these procedures before beginning the fault- 
finding process. Peripheral inspection and testing 
procedures are discussed in subsection 2.2-.2„ 

^-1 THE TROUBLESHOOTING PROCESS: A GENERAL DISCUSSION 



Fault-finding is largely a process of elimination. By performing the 
verification procedures outlined in this chapter, the u6t?r systt^maticaliy 
rules out possible sources of the problem until the malfunctionung component 
is isolated. The procedures require a high-quality oscilloscope capable of 
resolving pulses of approximately 200 nanoseconds and a high input impedence 
(10 meg ohms or greater) digital voltage meter- 

Once the defective component has been isolated, three possible courses of 
action are open: 

o Repair the component, following appropriate wiring 
diagrams. 

o Install a replacement component, obtained from a The 
HICROENGINE Company distributor or ordered directly 
from The llICROEbttJINE Company. A distributor list is 
available from any HICROENGINE Company representative., 

o Return the con^onent for service. If a peripheral 
device is malfunctioning, return the device to it;- 

Page 17 



manufacturer for service according to that 
manufacturer's service agreement. In the case of a 
malfunctioning Pascal hlCROEHGIhE Computer component, 
send that component to The IIICROENGIbE Company's 
factory for repair- If the computer is under 
warranty, the customer is responsible only for 
shipping the component to The MICRtENGINE Company; 
The niCROENGIhE Company provides required parts and 
labor and return shipping- If the computer is not 
under warranty, there is a fixed repair fee and the 
customer is responsible for all shipping. <For 
details, see the Pascal niCROENGINE Computer warranty 
statement and factory service agreement. 

4.2 SYflPTOn 1: OPERATING SYSTEH FAILS TO ANNOUNCE ITSELF 

Normally, when the Pascal [^erating system is loaded, it announces itself 

on the system terminal and prompts the user to enter a command. If the 

announcement and prompt line do not appear when the operating system is loaded, 
follow the procedures outlined in this section. 

4.2.1 Repeating the Software Loading Procedure 

First, try pressing the RE^T button. This button is located on the rear panel 
of the cofl^Juter housing, as illusti^ated in Figure 4-1. 

If the operating system still fails to announce itself, try reloading the 
f It^py disk and pressing RESET,. If this operation does not correct the 
problem, verify that the system termiiial ON/OFF switch is set to ON. If it is 
not, set the switch to W and then press the RESET button. If the operating 
system still fails to announce itself, try loading the backup operating system 
floppy disk and pressing RESET. 

4.2.2 Checking the Floppy Disk Controller Option Switches 

If none of the procedures outlined in subsection 4.1.1 correct the problem, 
check the settings of the Floppy Disk Controller hardware option switches. 
[As explained in subsection 2.1.2, th(?5e switches are set according to the 
size and density of the floppy disk or disks being loaded.) 

If the switches are not set appropriately, change their settings as described 
in Section 2.1.1. Reclose the computer housing, reload the floppy disk, and 
press the RESET button. 



Page 18 





Fijfure 4-1. RESET Button Location 



Figure 4-2. Location of the Power 
Supplies 



4.2f.3 rieasurinjg and Adjusting the Poiuer Supplies 



If the operating system still fails to announce itself after the !- loppy Disk 
Controller option switch settings have been checked, verify that the system 
power supplies are functioning properly and adjust them if they are not. 

Bejgin by unplugging the system and opening the computer housing. Turn the 
cofflputer on its side with the ON/OFF su»itch located at the top.' (Caution: 
the cossputer housing has sharp edpes, so be careful not to scratch your 
table top.) Remove the four screws on the computer panel and slide the rear 
panel and attached PC board all the way out of its mounting rails. Slide the 
top cover all the way out of its mounting rails and then replace th(? printed 
circuit board part-way back into its mounting rails. Locate the power supplies 
as illustrated in Figure 4-2. 

Note that the board includes 4 adjustable power supplies: +5 volts, H2 volts, 
-12 volts, and -5 volts. Measure the voltape of each by clipping a digital 
voitmeter across each pair of terminals as illustrated in Figure 4-3, 



Page 19 




Figure ^-3. Hea5urine .md Adjusting a Power Supply 

[f any of the supplies are not producing proper voltage, adjust then) to tpithin 
10 millivolts of their nominal level, insert a screwdriver into the slot 
provided on the pouter supply adjustment wheel for this purpose; turn the luheel 
to the right to increase the voltage or to the left to decrease the voltage. 
(Bee Figure ^-3.) 

HOTE. When replacing a pctuer supply (or the entire 
board), measure the v/oltage produced by each new 
supply andi if necessary, adjust it by following 
the procedure Just outlmsd- 

After verifying that the hardware option switches are set correctly, the next 
step depends on whether the floppy disk drive is active or not, (Activity on 
the drive can be detected by dirking noises produced when a floppy disk is 
loaded into it.) The fault-finder flow chart presented in Figure A-A 
diagrams the steps to be taken in either situation i see Section A. 6. 

^-3 SYilPTOn 2: TRANSFERS TO THf! SYSTEH TEROINAL FAIL 



If the Pascal Operating Systeti announces itself on the system terminal and 
accepts commands from the terminal, but is unable to transmit data to the 
system terminal successfully, check the configuration of the Pascal Operating 
System. See the Pascal III.O Operating System Reference llanual- 

Pi.ge 20 



A. A SYllPTOtl 3: TRANSFERS TO THE PARALLEL PORTS DEVICt OR FLOPPY DISK FAIL 

If the system is unable to perform successful transfers to the device 
connected to the parallel ports (e.g., a line printer) or to the floppy disk, 
perform the procedures diagrammed in Figure A-Ai see Section A. 6. 

A.5 SYWPTOil A: SYSTEH FAILS TO PASS DIAGNOSTIC PROGRAh 



If the system displays none of the symptoms discussed in Sections A. 2 - A. A 
but behaves erratically, execute the system diagnostic program. Replace 
malfunctioning ccwjponents according to the directions supplied by the program- 

^.6 THE TROUBLESHOOTING PROCESS: A SUmARY FLOW CHART 



Figure A-A presents a flou) chart diagramming the complete fault-findino 
process. 

NOTE: Use of this floui chart assumes a hi^Hi Iwel of 
competence luith advanced digital circuits and a 
background in the use and operation of all 
peripherals used in the complete Pascal 
IIICROEICINE System. Users not familiar u>ith 
digital logic are advised to return the complete 
unit to The I1ICR0ENGINE Company for comprehensive 
automated analysis. This procedure saves the 
user downtime and learning delays encountered 
when trying to fault-find an advanced electronic 
unit such as the Pascal HICROENGINE, 

To initiate use of the fault-finder flou> chart, the following conditions 
must be met: 

1) All line cords are plugged in, all power switches are 
"ON" with appropriate indicator also "ON", and ail 
peripherals are on-line. 

2) Operating system disk is in disk drive and is in 
"RESET" condition. 

3) User must have a high quality oscilloscope capable 
of resolving 200 nsec pulses and a high input 
impedence (lOlleg ohm or greater) D.V.n. for accurate 
readings without circuit loading. 

4) Pre~insta nation inspection and testing procedures 
have been performed for each peripheral device. 



Page 21 



Figure ^A. Fajlt-Finder Flow Chart 



FAULTFINDER 
FLOW CHART 



c 



©- 



REPLACE DISK AND 
GOTO (A) 



OISK, DISK DRIVE 
OR INTERCONNECTS 
ARE SUSPECT. 
ISOLATE AND GO 
10® 



OM 1883 IS SUSPECT 
=(EPLACE AND GO TO 
@ OR RETURN 

UNIT TO wyo 



^ 



I 






PUSH 

MASTER 

RESET 




CHECK OPERATING 

SYSTEM 

CONFIGURATION 



©■ 




REPLACE CHIPS 
PER INTERACTIVE 
DIRECTIONS 




Pige 22 



SYSTEM 
FUNCTIONAL 
READY FOR USE 



( "°' ) 



Fipure A-A, Fsult-Finder Flow Chart (Continued) 



NO FLOPPY 
ACTIVITY 



SWITCH DISK TO 
PROPER DRIVE AND 
GOTO® 




/jChipset is 
suspect. return 
unittow/d 



REPLACE DRIVE 
AND GO TO (a) 



CHIP SET SUSPECT 
RETURN TO W/D 




FD1791 IS SUSPECT 
REPLACE AND GO 
TO (a) or 
RETURN TO WD 



M.I.B. DEFECTIVE 
RETURN UNIT 
TO W/D 



RETURN DEFECTIVE 
DRIVE TO 
MANUFACTURER 



INTERNAL LOGIC 
ERROR. RETURN 
TO W/D 



WD1931 SUSPECT. 
REPLACE AND GO 
TO @ OR .RETURN 
TO W/D 




Page 23 



Figure ^-A. Fault-Finder Flow Chart (Continued) 



NO DATA TRANSFER 
TO LINE PRINTER 



KEYBOARD IS SUSPECT. 
FiEFER TO KB MANUAL 
FOR PERFORMANCE 
VERIFICATION. 



WD1931 IS SUSPECT. 
REPLACE AND GO TO 
© OR RETURN TO W/D. 



M.I.B., MEMORY OR 
(.CHIPSET IS 
DEFECTIVE. RETURN 

UNIT TO mo. 



Z9 (8225A) IS 
SUSPECT. REPLACE 
AND GO TO OR 
RETURN UNIT TO W/D. 




A WRITE FAULT FLAG 
HAS BEEN RECEIVED 
BY THE FD1791 (A16). 
EITHER DISK DRIVE, 
DISK, OR INTERCON- 
NECTIONS ARE 
INCORRECT. REFER TO 
APPROPRIATE MANUALS. 



NO DATA TRANSFER 
TO FLOPPY 



disable write 
protect and 
goto(e) 



PUSH MASTER RESET. IF 
PINS 3 & 39 DONT GO 
LOW, RETURN UNIT TO 
W/D. IF PINS GO LOW, 
GO TO (I). IF PROBLEM 
PERSISTS RETURN 
UNIT TO W/D. 



KEYBOARD IS SUSPECT 
REFER TO KB MANUAL 
FOR PERFORMANCE 
VERIFICATION. 



WD1931 IS SUSPECT. 
REPLACE AND GO TO 
(5) OR RETURN UNIT 
TO W/D. 



M.I.B. (.CHIPSET, OR 
MEMORY IS SUSPECT. 
RETURN UNIT TO W/D. 



DISK DRIVE IS STILL 
WRITE PROTECTED 
OR INTERCONNECTIONS 
ARE OPEN OR 
INCORRECT. RECHECK 
DRIVE UNIT AND CABLE. 
RETURN UNIT TO W/D 
IF PROBLEM PERSISTS. 





FD1791 OR DM1883 IS 
SUSPECT. REPLACE 
CHIPS OR RETURN 
UNIT TO W/D. 



DISK DRIVE IS 
SUSPECT. REFER TO 
CUSTOMER MANUAL 
FOR PERFORMANCE 
VERIFICATION. 



Page 2^ 



5. THEORY OF OPERATIONS 

This chapter describes the operation of the folloujinp Pascal 11ICR0ENGIME 
Computer cofl^onents: 

o Pascal niCROENGINE processor 

o riefflory 

o Serial ports 

o Parallel ports 

o Floppy Disk Controller and DI1A Controller 

Before discussing the operation of these components individually, this chapter 
presents an overvieiu of the mechanisms for communication between the processor 
and memory and between the processor and the ports and controllers. 

5-1 processor/hehory and processor/peripherals coihiunicatioh 

The Pascal HICR0ENGINE processor communicates luith the peripheral ports and 
controllers and with memory via a 16-bit data bus, a 16-bit address bus> and 
several control lines. These busses and control lines emanate from a processor 
controlled bus structure. This structure is comprised of a 16-bit address 
bus, 16-bit address latch, a 16 -bit bi-directional data bus, and latches and 
bus drivers as required for the control lines. The key control lines in this 
structure are listed in Table 5-1. 

The processor initiates communication with a peripheral device or a location 
in memory by loading the appropriate address onto the address bus. A 
peripheral device can initiate communication with the processor by requesting 
an interrupt. (Ilemory cannot initiate communication with the processor; all 
processor-memory communication is initiated by the processor.) The following 
subsections describe each of these communication mechanisms. 

In addition, the Floppy Disk Controller operates under control of the Direct 
riemory Access Controller, allowing data transfers between a floppy disk and 
memory without involving the processor. This type of communication is 
described in section 5.6. 



Page 25 



Figure 5-1 illustrates the location of these components on the PC board. 




Figure 5-1. Pascal llICFtOENGINE Computer Cou^onents 



Page 26 



Table 5-1. Communication Bus Structure Control Lines 



Line 



Function 



SYNC 



REPLY 



used by the processor to initiate a data 
transfer operation 

used by the ports and controllers to respond 
to the processor's data transfer signals. 



DIN (Data-in) used by the processor to cause the Read Data 
to be enabled onto the data bus. 

DOUT (Data-Out) used by the processor to cause the Write Data 
to be enabled onto the data bus. 

WB <Urite/Byte) used by the processor to signify a byte 
(rather than uiord) output operation. 

lOi II, 12, and 13 (Interrupts) 

used by the ports and controllers to request a 
processor interrupt, (Only 10 is used for all 
interrupts in the Pascal niCROENGIHE Computer) 

lACK (Internet Acknowledge) 

used by the processor to signify that it is 
responding to an interrupt. 

BUSREQ used by the DflA Controller to request access 
to a bus for a uiord transfer operation. 



BUSGRNT 



BUSY 



COMPUTE 



used by the processor to signal the DflA 
Controller that the requested bus is being 
relinquished to the controller for a word 
transfer operation. 

used by the DMA Controller to signal that the 
bus requested by the processor is not 
currently available. 

used to control execution of microinstructions 
by the processor. This line is tied true. 



Page 27 



5.1.1 ProcesBor/Hentory Coflimunic.sticm 

To imitiate cDinmuT»icatioT> luith a laca1;ion iti merooryi the prccpssor loads a 16- 
bit value bettt»een 0000 and EFFF onto the address bus- Any value in this ran.ge 
is a valid mesiory address and alerts ftemory for communication; the particular 
value corresponds to a 16-bit iBord at one of the 32.000 locations in memory. 

The processor also signals either the Data-in (DIM) control line or the Data- 
Out (DOUT) control line, as appropriate to the type of I/O to be performed. 
The memory unit acknowledges the communication and generates REI'LY to the 
processor and then responds to the DIM or DOUT line. On a Krad operation, the 
memory unit places the contents of thi? addressed luord onto the data bus; on a 
Write operation, data from the data bus is loaded into the addressed word in 
memory. 

5.1.2 Processor-Initiated Communic.jtion loith Peripheral Devices 



To initiate cofl»mjnication with a peripheral device, the processor loads a 16- 
bit address onto the address bus, as luhen addressing memory. Unlike a memory 
address, which has a simple one-for-one correspondence with a word in memory, 
a device address has two components: bits 4-15 identify the port or controller 
to which the desired device is attached, and bits 0-3 identify the desired 
element within that port or controller. For example, the value: 

FC20 (=1111 1100 0010 0000) 

addresses the control register of serial port B. FC2x is the general address 
of serial port B, where the value of "x" (0 in the example above) identifies 
the particular element (the control register m the example) of the serial 
port. 

The processor addresses all peripheral devices in this manner, with one 
exception. The general address FClx references either serial port A or the 
system terminal specifications hardware option switches. (These switches are 
discussed in section 2-1.) If bit 3 is set, these switches are activated and 
bits 0-2 are ignored; if bit 3 is not set, serial port A is addressed and bits 
and 1 identify the desired element of that port. 

Table 5-2 lists the standard ge-neral device addresses. The values for 
selecting particular device elements are detailed in subsequent sections of 
this chapter. 



9s 



ge 28 



Table 5-2. Standard General Device Addres&e5 



Address Unit 



FC7x 


Parallel ports 


FC6x 


Reserved 


FC5x 


Autoload 


FCAx 


Reserved for Interrupt priority latch 


FC3x 


Floppy Disk Controller and DfIA 




Controller 


FC2x 


Serial port B 


FCix 


Serial port A and system terminal 




specifications switches 


FCOx 


System value of nil 



As in a memory access, the processor also signals the DIN or DOUT line when 
addressing a port or controller. The port or controller acknowledges the 
communication and generates REPLY to the processor and then responds to 
the DIN or DOUT line. On a Read operation, the device places data on the data 
bus; on a Write c^erationi data is loaded from the data bus into the device. 

5. .1..3 Device-Initiated Communication with the Processor: Interrupts 



When an I/O device requires service, it signals the 10 control line- When the 
processor detects the signal, it enables the 10 line and disables the II, 12, 
and 13 lines by loading the general device address FC^x onto the address bus, 
with: 

1 

as the value of "x." The device then places a vector address on the data 
bus. A vector address is a code used to direct the appropriate interrupt 
service routine. The processor signals the lACK control line to signify that 
it is responding to the internet. 

If multiple interrupts occur simultaneously, the processor responds to them 
one at a time, in order of priority. Table 5-3 lists the interrupt 
conditions, their priorities, and the associated vector addresses. 



Page 29 



Table 5-3. Interrupt Contlitions and Vector Addresses 



Vertur 
Interrupt Priority Address 



DMA Highest 0020 

Serial port A receive 0024 

Serial port B transmit 0028 

Serial port B receive 002C 

Serial port A transmit 0030 

Serial port A or B exception 0034 

Parallel input port 0038 

Parallel output port 2 Lowest OOX 



5,2 PASCAL niCROENGIhE PROCESSOR 



The Pascal niCR[ENGINE Con^uter is driven by the Pascal HICROENGIWE 
processor. This processor is comfirised of five LSI/TttJS circuits, each 
contained in a 40-pin package. The chips are. 

o The Data Chip, containing the microinstruction decoder, 
the Arithmetic and Logic Unit (ALU), and the register 
file. 

o The Control Chip, containing the macroinstruction 
decoder, portions of the control circuitry. the 
microinstruction counter. and input/output control 
logic. 

o Three 22 by 512-bit niCROM chips, holding the 
microinstructions. 

The processor uses four power supplies (+5 volts. +12 volts. -12 volts, and 
-5 volts) and runs off a 3-l1Hz clock signal that is subdivided into 4 
nonover lapping phases (75 nanoseconds per phase). All I/O signals are tri- 
state. 

Figure 5-1 demonstrates the location of the processor chips on the board. 

The processor chips are interconnected by an 18-bit microinstruction bus which 
provides bidirectional communication between chips for addresses and 
instructions. The 16-bit data access bus provides access to the inter- 
cof^onent communication bus structure. As described in section 5.1. this 
structure allows the processor to communicate with memory and the peripheral 
ports and controllers. 



Paje 30 



For more information on the Pascal MICROENGINE processor! see the "WD/9000 
Pascal I1ICR0ENGIKE llicroprocessor Chip Set" data sheet. 

5.3 I1EI10RY 



The Pascal l1IC3?t«NGINE Computer includes 32 16K RAH chips, providing 64K bytes 
<32K words) of tlOS dynamic random access memory <RAI1). Each RAH chip is 
ori;ianized as 16,384 words by 1 bit, and is packaged in a standard 16-pin dual 
in-line package. Figure 5-1 illustrates the location of the memory package on 
the board. 

Section 5.1 describes the mechanism by which the processor communicates with 
memory. In the Pascal I1ICRCENGINE Computer, the Floppy Disk Controller 
operates under control of the DMA Controller. As described in section 5-6, 
the DMA Controller allows for direct data transfers between the Floppy Disk 
Controller and memory, without involving the processor. 

5. A SERIAL PORTS 



Two RS-232 asynchronous serial ports are provided with the Pascal I1ICR0ENGINE 
Computer. One of these ports ~- the A port — is used for connecting the 
system terminal to -Wie system. The second port ~ the B port — is available 
for connecting any other RS-232 device to the system. (Section 2.2 describes 
the procedures for connecting terminals to the serial ports.) The location of 
the serial ports is presented in Figure 5-1. 

Communication between the serial ports and the processor is achieved via the 
inter -coflqjonent communication bus structure, described in section 5.1. A 
terminal is connected to a serial port via a serial port cable connector. 
This section is concerned with the operation of the serial ports within this 
structure. Table 5-A lists the pin assignments of a serial port cable connector. 



Page 31 



Table 5-4 Serial Port Cable Connector Pin Assignments 



Pin 


Nuaber 


Signal 


Description 


Jl-1 


or J2-1 


AA 


FRAI1E GROUND 


Jl-2 


or J2--2 


BA 


TD- UD 1931 


Jl-3 


or J2-3 


BB 


RD- UD 1931 


Jl-4 


or J2-4 


CA 


RTS UD 1931 


Jl-5 


or J2-5 


CB 


CTS UD 1931 


Jl-6 


or J2-6 


CC 


DSR UD 1931 


Jl-7 


or J2-7 


AB 


SIGNAL GROUND 


Jl-8 


or J2"8 


CF 


CARD UD 1931 


Jl-9 


or J2-9 







Jl-10 or J2-10 

Jl-11 or J2-11 

Jl-12 or J2-12 

Jl-13 or J2-13 

Jl-14 or J2-14 

Jl-15 or J2-15 DB IXRC UD 1931 

Jl-16 or J2-16 

Jl-17 or J2-17 DD IXRC UD 1931 

Jl-18 or J2-18 

Jl-19 or J2-19 

Jl-20 or J2-20 CD DTR UD 1931 

Jl-21 or J2-21 

Jl-22 or J2-22 CE RING W J 931 

Jl-23 or J2-23 

Jl-24 or .12-24 

dl-25 or J2-25 



The serial ports have been imp lemeniied with taio UC1931A/B devices. The UC1V31 
offers a number of programmable capabilities: the device can operate in either 
synchronous or asynchronous mode, for example. l*en the Pascal Operating 
System is loaded* it automatically programs the serial port devices according 
to a pre-defined set of specifications. Some of these specifications are 
provided within the operating systemi others are read from the hardware option 
switches. (Recall from section 2.1 that the system provides hardware option 
switches for specifying system termina] characteristics and for defining the 
baud rate for each serial port.) 

Subsection 5.4.1 describes how the serial ports operate under this set of 
specifications. For the user who wishe-s to program the serial port devices to 
operate in some other manneri siAsecticm 5.4.2 describes the mechanisms for 
programming the devices and briefly di«>cusses their full programmable 
capabilities. 



Pagc> 32 



5,AA Operation of the Serial Ports 



Each serial port device includes several registers. Of primary interest are: 

o Receiver Register. This 8-bit shift register receives 
data From the attached device. The incoming data in 
assembled and then transferred to the Receiver Holding 
Register with logic zeros filling any unused higfj-order 
bit positions. 

o Receiver Holding Register. This 8-bit parallel buffer 
register presents the assembled characters to the data 
bus ©hen requested through a Read operation. The term 
"Receiver" is used in this manual to refer to the 
Receiver Register and the Receiver Holding Register. 

o Transmitter Holding Register. This B~bit parallel 
buffer register holds parallel data transferred from 
the data bus by a Write operation. This data is 
transferred to the Transmitter Register tt^>en 
transmission is enabled. 

o Transmitter Register. This 8-bit shift register is 
loaded from the Transmitter Holding Register. The data 
is serialized and presented to the attached device lehen 
transmission is enabled. In this manual* the term 
"Transmitter" refers to the Transmitter Holding 
Register and the Transmitter Register. 

o Control Registers. These tu»o 8-bit registers hold 
device programmed control words. The contents of these 
registers are described in subsection 5.^.2. 

o Status Register. This 8-bit register holds information 
on the status of the port's operation. 

The timing of the transfer of data to and from the data bus and the attached 
device is controlled by a BR1941L-6 Baud Rate Clock. The rate supplied by the 
Baud Rate Clock to each of the serial ports is set by the hard»»are option 
switches provided for this purpose. (These suiitches are described in 
subsection 2.1.3.) 

Recall from section 5.1 that the processor initiates communication mith serial 
port A by loading the general address FClx onto the address bus; to address 
serial port B, the processor loads FC2x. In both cases* the value of "x" 
determines uihich serial port register is selected. Recall further that the 
general address for serial port A is used also to activate the system terminal 
specifications switch. 

Table 5-5 lists values used to address serial port registers and the system 
terminal specifications switch. 

In this tables <and subsequent tables in this chapter), a hiashen < -) denotes a 

Page 33 



"don't care" value; i.e./ any value maij appear in the corresponding position. 

Table 5-5. Serial Port Addresses 



Operation 



General 

Address Value of "x" Element Selected 



Input from 

Serial Port A FClx 



0-10 
0-11 



Status Register 
Receiver Holding 
Register 



Output to 

Serial Port A FClx 



0-11 



Transmitter Holding 
Register 



Activate System 
Terminal Speci- 
fications Switch FClx 



1 - 



Input from 








Serial Port B 


FC2x 


- - 1 


Status Register 






- - 1 1 


Receiver Holding 
Register 



Character framing is provided by a Start bit (logic zero) at the beginning of 
a character and a Stop bit (logic one) at the end of a character. When 
information is transferred from -Wie Transmitter Holding Register, transmission 
is initiated. A Start bit is inserted, followed by the serial output of the 
character (least significant bit first) with parity (if enabled) after the 
most significant bit. A stop condition (1, 1.5, or 2-bits) is then inserted. If 
the Transmitter Holding Register is full, the next character transmission 
starts after the Stop bit(5) of the character currently in the Transmitter 
Register have been transmitted. Otherwise, the Hark (logic one) condition is 
continually transmitted until the Transmitter Holding Register is loaded. 

Reception of a character into the Receiver Register is initiated when the 
first Start bit after a preceding Stop bit is recognized. During the assembly 
of the character from serial to parallel, the Start and Stop bits (and the 
parity bit, if enabled) are stripped cff. The assembly is completed when the 
Stqj bit following the last character bit is received. If the Stc^ bit is a 
logic one, the character is determined to have correct framing and the port is 
prepared to receive the next character. If the Stop bit is a logic zero, a 
framing error has ocurred. The device assumes that the bit is the Start bit 
of the next charact-er. Character assembly continues if the input is still a 
logic zero when saiqjied at the theoretical center of the assumed Start bit. As 
long as -Wie received input is spacing, all zero characters are assembled. 
Error flags and data received internets are generated so that line breaks can 
be determined. After a character of all zeros is assembled along with a zero 
in the Stop bit location, the first received logic one is accepted as a Stop 

Patte 3A 



bit; u»hen this bit is received, the device is prepared to receive the next 
character. 

As Table 5-5 has demonstrated, the contents of the serial port status 
registers can be read onto the data bus. Table 5-6 outlines the significance 
of each bit in the status register. 

Table 5-6. Serial Port Status Register Contents 



Bit Hame 



{leaning 



TRANSI1ITTER HOLDING 
REGISTER EWPTY 



This bit is set to a 1 bit when 
the Transmitter Holding Register 
does not contain a character and 
the Transmitter is enabled. It 
is set to a 1 bit when the 
contents of the Transmitter 
Holding Register are transferred 
to the Transmitter Register. It 
is cleared to a bit when the 
Transmitter Holding Register is 
loaded from the data bus or the 
Transmitter is disabled. 



DATA RECEIVED 



This bit is set to a 1 bit «^en 
the Receiver Holding Register is 
loaded from the Receiver 
Register and the Receiver is 
enabled. It is cleared to a 
bit B»hen the Receiver Holding 
Register is read onto the data 
bus or when the Receiver is 
disabled. 



OVERRUN ERROR 



This bit is set to a 1 bit when 
the previous character in the 
Receiver Holding Register has 
HOT been read when a new 
character is ready to be 
transferred to the Receiver 
Holding Register. 
Otherwise, the bit is cleared 
when a character is transferred 
to the Receiver Holding 
Register. It is cleared irtien 
l^e Receiver is disabled. 



Page 35 



3 PARITY ERROR 



Th2i5 bit is set to a 1 bit iBhen 
th(? Receiver and parity are 
en<ibl€d and the last received 
character has a parity error. 
The bit is set to a bit if the 
character has correct parity. 



^ FRAniNG ERROR 



Th:i5 tit is set to a 1 bit if 
the bit after the last data bit 
of a character is a zero and the 
Resreiver is enabled. This bit 
is set to a bit if the bit 
after the last data bit of a 
character is a one. 



5 CARRIER DETECTER 



This fcit is the complement of 
the C^»RRIER DETECTOR input (pin 
39). 



6 DATA SET READY 



This bit is the complement of 
the DATA SET READY input (pin 
33). 



7 DATA SET CHANGE 



This I'it is set to a 1 bit when 
there is a change in the state 
of the? DATA SET READY or CARRIER 
DETECTOR inputs with the DATA TERillNAL 
READY" output (pin 17) on/ or the 
Ring; Indicator is turned on taith 
the DATA TERniNAL READY- output off. 
This bit is cleared to a bit mtjon 
the Si:atu5 Register is read onto 
the diita bus. 



Page 36 



5.A.2 Device Programminp tiechanism: the Control Registers 



Each of the serial ports can be individually prografluned to operate in either 
synchronous mode or asynchronous mode. Asynchronous mode is the default when 
the Pascal Operating System is loaded; the operation of a serial port in 
asynchronous mode has been described in subsection 5.4,1. In synchronous 
mode/ tuKJ registers are of interest in addition to those discussed in sub- 
section 5,4,1: 

o SYN Register, This 8-bit register holds the 
synchronization code used to establish character 
synchronization, 

o DLE Register, This 8-bit register holds the DUE 
character used urfien the optional transparent mode is 
in effect. 

In synchronous mode/ character framing is achieved by the SYN character* 
transmitted at the beginning of a block of characters, i*ien the Receiver is 
enabled/ it searches for tu»o continuous characters matching the bit pattern 
contained in the SYN Register, 

The serial port devices are programmed via two 8-bit control registers: 
Control Register 1 and Control Register 2, Tables 5-7 and 5-8 outline the 
contents of these registers. 

Table 5-7, Serial Port Control Register 1 Contents 



Bit Name Function 



DATA TERMINAL READY This bit controls the DATA 

TERMINAL READY- output <pin 17), 
which controls the CD circuit of 
the attached terminal, ^en 
this bit is set to a 1 bit/ the 
Carrier On and Data Set Ready 
interrifljts are enabled. Wien 
this bit is set to 0/ only the 
Ring On interrupt is enabled. 



Page 37 



REQUEST TO SEND 



This bit controls the RECAST TO 
SEM5- output (pin 32), which 
controls the CA circuit of the 
attached terminal. When thii> 
bit is set to a 1 bit and the 
CLEAR TO SEND- (pin 29) input i& 
lcjB», transmission of data to the 
attached terminal is enabled and 
Transmitter Holding Register 
Eiapty interrupts are generated. 
When this bit is set to a 
bit, transmission is disabled 
arter any current character has 
been transferred. 



RECEIVER ENABLE 



mien set to a i bit, this bit 
enables the Receiver, allowing 
received characters to be placed 
in the Receiver Holding 
Register. Status bits 1, 2, 
and 3 are updated and a Data 
Received interrupt is 
generated. Character reception 
starts with a Start bit lehen in 
asynchronous mode or with 2 
matches to the contents of the 
SYN Register when in synchronous 
mode.K When the RECEIVER ENABLE 
bit is set to a bit, status 
bits 1, 2, 3, and A are cleared. 



PARITY ENABLE 



When this bit is set to a 1 bit, 
parity checking on received 
characters is enabled. In 
asynchronous mode, « generation 
of parity for transmitted 
characters is also enabled. When 
this bit is set to a bit, 
parity checking and generation 
an- both disabled in either 
moce. 



ECHO MODE, DLE STRIP, 
or MISCELLANEOUS 



Th€' function of this bit depends 
on whether the device is 
opi-rating in synchronous or 
asynchronous mode. x In 
asynchronous mode, bit A 
controls echo mode. If the 
Receiver is enabled and this bit 
is set to a 1 bit, the received 
data is echoed with a l-bit 
delay. The clocked regenerated 
da1;a, rather than the output of 
th€? Transmitter Register or a 



Paoe 38 



steady marking, is presented to 
the TRANSniTTED DATA output 
(pin 25), The Transmitter need 
not be enabled. In synchronous 
mode* the function of this bit 
is further dependent on whethpr 
the Receiver is enabled or not^ 
If the Receiver is enabled and 
bit A is set to a 1 bit> 
received characters tuhich match 
the contents of the DLE 
Register are stripped out and 
parity checking is disabled. 
When the Receiver is not 
enabled/ bit A controls the 
niSCELLANEOUS- output (pin 5). 
When this bit is set to a 1 bit. 
this output is made 1o«j> when 
the bit is set to a bit* the 
output is made high. When 
c^erating i»ith a 32X clock (see 
Table 5-8> Bits 2-"0)> a 1 bit 
with the Receiver not enabled 
causes the Receiver bit timing 
to synchronize on mark -space 
transitions. 



STOP BIT SELECTION, 
niSCELLANEOUS, TRANSMIT 
PARITY ENABLE, or 
FORCE DLE 



The function of this bit depends 
on whether synchronous or 
asynchronous mode is in effects k 
In asynchronous mode ©ith tt»e 
Transmitter enabled, bit 5 set 
to a 1 bit causes a singlf* Stop 
bit to be transmittedi bit !> r-et 
to a bit causes 2 Stop bits to 
be transmitted for character 
lengths of 6, 7, or 8 bits, and 
1.5 Stop bits for a character 
length of 5 bits. When the 
Transmitter is not enabled, bit 
5 controls the tllSCELLANEOUS- 
output (bit 5). When this bit 
is set to a 1 bit, this output 
is made loiu; a^hen the bit is set 
to a bit, the output is made 
high. In synchronous mode, the 
function of bit 5 is further 
dependent on bit 6. If both 
bits are set to a 1 bit, the 
contents of the DLE Register are 
transmitted prior to the next 
character loaded in the 
Transmitter Holding Register. 
When bit 5 is set to a 1 bit and 



Page 39 



bit 6 is set to a bit, 
braiisfflit parity is enablrd,. 
iJheTi bit 5 is set to a bit, 
parity is generated. 



no 



BREAK or TRANStllT 
TRANSPARENI 



The function of- this bit depends 
on whether synchronour> or 
asynchronous mode is in effect. » 
In ((Synchronous mode, ivhen bit 6 
is bet to a 1 bit and the 
Transmitter is enabled, the 
TRAHStllTTED DATA output (pin 25) 
is held in a spacing condition 
•starting toith the end of any 
current character. Normal 
Transmitter timing continues so 
that the break can be timed out 
by loading charaters into the 
Transfflitter Holding Register. 
Thai; is, interrupts are gencrrated 
-and the Transmitter operates 
i»orfl»ally except for the output 
iuhit;h remains lout while bit 6 if- 
'5et to a 1 bit. In synchronous 
mode, bit 6 set to a 1 bit 
caujies the Transmitter to be 
conditioned for the transparent 
transmission: idle fill is 
i)LE-SYN and a DLE can be forced 
aheiid of any character in the 
Transmitter Holding Register by 
use of bit 5. 



LOOP/NORriAL 



I4hen this bit is set to a bit> 
the device is configured to 
provide an internal data and 
con-ijrol loop and the Ring On 
interrupt is disabled. When 
thi'i bit is set to a 1 bit, the 
dev:.ce is normal full di^lex 
con^-iguration and the Ring On 
int«»rrupt is enabled. 



w Synchronous/asynchronous mode is controlled by bit 5 of 
lk)ntrol Register 2 (Table 5-8). 



Pagj? 40 



Table 5-8. Serial Port Control Reqister 2 CantentB 



Bit(s> Name 



Function 



2-0 CLOCK SELECT 



These bits select the transmit find 
receive clock as follows: 







- Transmit and receive 
clock input <1X) 
1 - Rate 1 (32X> 

- Rate 2 (32X) 

1 - Rate 3 (32X) 

" Rate 4 <32X) 

1 " Rate A ~ 2 (32X) <6^X) 

- Rate ^ - -q (32X) (120X) 

1 - Rate ^ - 8 <32X) (Zh'^X) 






1 



1 
1 1 
1 1 



3 ALTERNATE RECEIVER 
CLOCK or STRIP SYN 



The function of this bit depends 
on whether bit 5 selects 
asynchronous or synchronous 
mode. In asynchronous mode* if 
bit 3 is set to a bit* Rate 1 
is selected as the Receiver 
clock rate; if bit 3 is set to a 
1 bit* the Receiver clock rate 
is determined by bits 2 0. (If 
IX clocking is selected in bits- 
2-0* bit 3 must be 1.) In 
synchronous mode* if bit 3 i«> 
set to a 1 bit and the Receiver 
is enabled* received characters 
which match the contents of the 
SYN Register are stripped out 
and the SYN status bit is set 
with the next character. No SYN 
stripping occurs if bit 3 is t>et 
to a bit. 



PARITY ODD/EVEN 



Odd parity is selected when this 
bit is set to a 1 bit* n^en it 
is set to a bit* even parity 
is selected. 



CHARACTER MODE 



When this bit is set to a 1 bit* 
asynchronous mode is selected* 
when it is set to a bit* 
synchronous mode is selected. 



Page 41 



7-6 



CHARACTER LENGTH 



These bits select the nuflrt>er of 
bits per character as folloius: 




') 1 

1 
I 1 



8 bits 
7 bits 
6 bits 
5 bits 



For exaaplei when the Pascal Operating System is loaded* it reads the system 
terminal specifications hardware oijtion switches and then loads the serial 
port A Control Register 2 with tie corresponding values. Switches 1-8 
correspond to Control Register 2 values 0-7 respectively. 

The processor can load a value into either control register of either serial 
port, and it can read the current contents of either control register of 
either port. The processor can also load values into the SYN and DLE 
registers for use in synchronous modei these registers cannot be read. Table 
5-9 lists the values used by the processor to address the serial ports SYN, 
DLE. and control registers. 

Table 5-9. Serial Port SWi, DIE, and Control Register Addresses 







General 










Operation 




Address 


<^alue 


of 


"X" 


Element Selected 


Input frcM 














Serial Port 


A 


FClx 





- 





Control Register 1 











- 


1 


Control Register 2 


Output to 














Serial Port 


A 


FClx 





- 





Control Register 1 











- 


1 


Control Register 2 











- 1 





SYN and W-E Registers 


Input fro« 














Serial Port 


B 


FC2x 


: 


- 

- 




1 


Control Register 1 
Control Register 2 


Output to 














Serial Port 


B 


FC2x 


- 


- 





Control Register 1 








- 


- 


1 


Control Register 2 










- 1 





SYN and DLE Registers 



For more information of the serial pert devices, see the "UC1931A/B" data 
sheet, available from Western Digital Corporation. 



Pcge A2 



5.5 PARALLEL PORTS 



The Pascal HICRCENGIIC Computer provides a parallel I/O capability in the form 
of an 8255A Programmable Peripheral Interface device, a standard 40-pin dual 
in-line package with 24 progratmoab le pins. See Figure 5-1. 

Communication between the parallel ports and the processor is achieved via the 
intra-component communication bus structure, described in section 5.1. A 
terminal is connected to the parallel ports via a parallel port cable 
connector. Table 5-10 illustrates the pin assignments of a parallel port 
cable connector. 

This section is concerned with the operation of the parallel ports within this 
configuration. Subsection 5.5.1 describes the normal operation of the Pascal 
niO^CEWSIhE Co«H3uter parallel ports device; that is* it explains how the 
device iterates when it is programmed automatically by the Pascal Operating 
System. For the user who wishes to program the device to operate in somp 
other manner, subsection 5.5.2 describes the mechanism for programming the 
device and briefly discusses the modes in which it can operate, 

5.5.1 Default Operation of the Parallel Ports 



When the Pascal Operating System is loaded, it automatically programs the 
parallel ports device to provide an 8-bit input port (Port A) for reading from 
the attached peripheral device, an 8~bit output port (Port B) for writing to 
the peripheral device, and an 8-bit control port (Port C). I/O data is 
transferred between the peripheral device and Ports A and B in conjunction 
miM strcrfjes, or "handshaking" signals. These signals are generated or 
accepted on Port C lines, as listed in Table 5-11. Input and output data are 
bottt latched. 



Page 43 



Table 5-10 Parallel Port C.ible Connector Pin AssiqnmentR 





Pin 










Wuffiber 


Signal 


Description 






,13-1 


GND 








J3-2 


PA.1 


DATA 1 PORT A 






J3--3 


PAO 


DATA PORT A 






J3-A 


PA^ 


DATA A PORT A 






J3--5 


PAA 


DATA 6 PORTA 






J3~A 


BACKB- 


ACKNOWLEDGF B 






J3-7 


STBA- 


STROBE A 






J3-8 


PABIF- 


OPEN- PA BUS IN FAISF 






J3-? 


SPC7 


DATA 7 PORT C 






J3-10 


SOBFB- 


OUTPUT BUFFER FULL B 






J3~ll 


I/W>C6 








.J3-12 


I8FA 


INPUT BUFFER FULL A 






J3--13 










J3-l^ 










J3~15 


PB6 


DATA A PORT B 






J3-16 


PBA 


DATA A PORl B 






J3-17 


PBS 


DATA 3 PORT B 






J3--18 


PBO 


DATA PORT B 






J3-19 


RESET 








J3"-20 


GNl) 








J3-21 


PA2 


DATA 2 PORT A 






J3-22 


PA3 


DATA 3 PORT A 






J3-23 


PA5 


DATA 5 PORT A 






.J3-2'1 


PA7 


DATA 7 PORT A 






J3--25 


ACKB- 


ACKNOWLEDGE B 






J3-26 










J3--27 


SPC6- 


DATA 6 PORT C 






v)3--28 










J3--29 


I /OP C7 








J3--30 


OBFB- 


OUTPUT BUFFER FULi B 






J3-31 


SIBFB- 


INPUT BUFFER FULL B 






J3-32 


PBBOF 


OPEN PB BUS OUT FAISF 






J3-33 


PB7 


DATA 7 PORT B 






J3-34 


PB!> 


DATA 5 PORT B 






J3-35 


PB2 


DATA 2 PORT B 






J3-36 


PB1 


DATA 1 PORT B 






J3~37 


GWl) 







Pagt AA 



Table 5-11. Parallel Ports Device Control Lines <Port C) 



Bit Name 



Fimction 



INTRB (Interrupt 
Request* Port B) 



1 OBFB- (Output Buffer 
Full) 



A high on this output int-erruptB 
the processor when Port U ie- 
requesting service. 

A loiB on this output indicates 
that data has been loaded into 
the Port B latch for out-put; it 
is> in essence* on acknoialedgement^ 



ACKB- (Acknoujledpe 
Input) or INTEB-' 
(Interrupt Enable* 
Port B) 



3 INTRA (Interrupt 
Request; Port A) 



A STBA- (Strobe Input) 



5 IBFA (Input Buffer 
Full) 



6 mXEA 



On output* a high on this pin 
enables interrupts from Port B. 
On input* a low on this pin indicates 
that data output from Port B has 
been accepted by the peripheral 
device« When the Pascal 
Operating System is loaded* it 
makes this pin high to enable 
Port B interrupts. 

A high on this output int-errupts 
the processor when Port A is 
requesting service. 

A lou> on this input loads data 
into the Port A latch for input, 

A high on this output indicates 
that data has been loaded into 
the Port A latch for input* it 
is* in essence* an acknowledgement. 

A high on this output enables 
interrupts from Port A. When 
the Pascal Operating System is 
loaded* it makes this pin low to 
disable Port A interrupts. 

This pin is not used. 



Page A5 



Recall from section 5.1 that the processor initiates communication with the 
parallel ports by loading the general address FC7x onto the address bus* mhere 
the value of "x" determines which device element is selected^ Table 5-12 
lists the values used to address Ports A* B> and C. 

Table 5-12. Par^jllel Ports Addresses 



General 
jeration Address Value of "x" Element Selected 



Input from or FC7x - - Port A 
output to - - t Port B 

parallel ports - - I Port C 



5.5.2 Device Programming tiechanisro: the Control Register 



Parallel Ports A and B can be individually programmed to operate in any of 
three modes: 

o Mode 0* the basic input/output mode. In l^is mode* 
data is simply read from or written to tt>e port; no 
"handshaking" signals are required. 

o Hode 1> the strobed input/output mode. This is the 
mode selected in the default device programming> 
described in siAsection 5.5.1. 

o node 2, the strobed bidirertional bus input/output 
mode. In this mode> data is transferred to and from a 
peripheral device on a single 8-bit bus. Handshaking 
signals are provided tc maintain proper bus flow 
discipline in a manner simdlar to Hode 1. 

Port C is programmed in two sections: the upper half (bits 0-3) and the lower 
half (bits 4-7). The mode of the upper half of Port C is defined with the 
mode of Port A; the mode of the lower half is defined with the mode of Port B. 

The parallel ports device is programmed via the 8-bit Control Register. Table 
5-13 outlines the contents of this register. 



Page 46 



Table 5-13, Parallel Ports Control Re.gi5ter Contents 



Bit 



Name 



Function 



LOWER PORT C 
DIRECTION 



When this bit is set to a 1 bit> 
the lines on the lower half of 
Port C are used as input lines. 
When this bit is set to a bit^ 
these lines are used as output 
lines. 



PORT B DIRECTION 



PORT B AND LOWER 
PORT C MODE 



UPPER PORT C 
DIRECTItW 



This bit, u»hen set to a 1 bit, 
defines Port B as an input 
port. When this bit is set to a 
bit. Port B is used as an 
output port. 

Wfien this bit is set to a 1 bit, 
Mode 1 is selected for Port B 
and the lomer half of Port C. 
When this bit is set to a bit, 
Mode is selected. 

ifhm this bit is set to a 1 bit, 
the lines on the upper half of 
Port C are used as input lines.; 
when this bit is set to a bit, 
these lines are used as output 
lines. 



4 



PORT A DIRECTUM! 



5,6 



PORT A AWD UPPER 
PCMiT C MODE 



When this bit is set to a 1 bit, 
Port A is used as an input 
port. When this bit is set to a 
bit. Port A is used as an 
output port. 

These bits select the mode For 
Port A and the upper half of 
Port C as follows: 



node 

1 node 1 

1 - node 2 



Page 47 



nODE SET FLAG 



This bit controls the mode set 
flag. When it is set to a 1 
bit, this flag is active. VJhnn 
it is set to a biti this flag 
]LS inactive. (This flag is 
normally inactive only ujhile 
modes are being changed.) 



For example* the value automatically loaded into the Control Register by the 
Pascal Operating System is shown in Figure 5-2. 







10 110 10 



! Port C lower = input or output 

Port B = output 



-Port B S Port C lou»er = I'tode 1 
-Port C upper = input 
-Port A = input 

—Port A & Port C upper - i1ode 1 
-node set flag = active 



Figure 5-2. Default P.jrallel Port Control Register Values 

To load a value into the Control Register, the processor uses the parallel 
port address, FC7x, with 

- - 1 1 

as the value of "x." 



Page 48 



5.6 FLOPPY DISK CONTROLLER AND DMA CONTROLLER 



The FD1791/2 Floppy Disk Controller (FDC) provided with the Pascal HICROEHQIHE 
Computer is switch-selectable for sincjle- or double-density O-inch or 5-l/'^- 
inch disks and can handle up to four disk drives of the same type, (he Floppy 
Disk Controller operates under control of the Di11883A/B Direct Hemory Access 
Controller (DMAC), alloiuinp data transfers between the floppy disk and mefflory 
without involving the processor. 

Both the FDC and the DUAC are standard 40-pin dual in-line packages* located 
on the board as shown in Figure 5-1. 

Communication between these controllers and the processor is achieved via the 
inter-component communication bus structure^ described in section 5.1. A 
floppy disk drive is connected to the floppy disk controller via a 1- loppy Disk 
Controller cable connector. Table 5-14 lists the pin assignments of the FDC 
cable connector. 

This section is concerned with the operation of the Floppy Disk Controller and 
the DMA Controller within this configuration. Subsection 5.6.1 describes 
automatic system start-up procedures that involve the DI1AC and the FDC. I?) 
subsection 5.6.2> the mechanism by which the processor initiates communication 
with these controllers is discussed. Subsections 5.6.3 and 5.6.4 provide 
information on the operation of the DtlAC and FDC, respectively. 



Page 47 



Table 5-14. Floppy Disk Cable Connector Pin Assignments 



Pin 






Hunber 


Signal 
CHD 


Description 


M~l 




J4-2 


DSl 


UNIT SELECT 1 


dA~3 


DS3 


UNIT SELECT 2 


vM-4 


SDSEl. 


SIDE SELECT 


M~5 


GHD 




JA-6 


STEP- 


STEP 


M-7 


GND 




J4-8 


UD 


WRITE DATA 


iW-9 






J4-10 


W»RT- 


URIIE PROTECT 


xi4-ll 


[>*HD 




04-12 


TRKO- 


TRACK 00 


J4-13 


(M) 




J4-14 


RDTA 


RAU READ DATA 


J4-15 


GND 




J4-16 


READY 


DRIVE READY 


J4-17 


GND 




J4-18 






J4-19 


«F 


WRITE FAULT 


J4-20 


GND 




J4-21 


DS2 


UNIT SELECT 2 


J4-22 


DS4 


UNIT SELECT 4 


J4-23 


HLD- 


HEAD LOAD 


J4~24 


GND 




J4-25 


DIRC 




J4~26 


GND 




J4-27 


UG- 


WRITE GATE 


J4-28 


GND 




J4-29 


TG4:i 


TRACK 43 


J4-30 


GMD 




J4-31 


IP 


INDEX PULSE 


J4-32 


GND 




vW~33 


RCLK 


READ CLOCK 


J4-34 


GND 




J4-35 


+5 




J4-3A 


+5 




J4-37 


HLT 


HEAD LOAD Till 



Page 50 



5.6.1 Start-l^ Procedures Involving the DtlAC and FDC 



Uhen the Pascal MIC^OEhttSIhE Computer is started* the settings of the Floppy 
Disk Controller hardware option switches take effect. (Recall from subsection 
2.1.2 that the user sets these switches according to the characteristics of 
the floppy disk or disks to be loaded.) 

o If the switch settings specify double-density 

(Iteration, the DDEM- input (pin 37) of the FDC is 

made low. If single-density operation is indicated, 
DDEH- is aade high. 

o If the switch settings call for an 8-inch floppy 

disk» a 2 Wz clock signal is supplied to the CLK 

input (pin 24) of the FDC. If 5-1/4-inch floppy 

disks are indicated, a 1 IIHz clock signal is 
sL^plied to the CLK input. 

Also at syste* start-up, the AUTLD input (pin 37) of the DTIAC is made high. 
When a floppy disk is loaded into a drive, this input causes an automatic boot 
loading of the first 64K words from the floppy disk into memory, starting at 
memory location 0. A high on the AUTLD input also places the DHAC in run mode 
and enables two of the device's three interrupt conditions, (See subsection 
5.6.3.) 

5.6.2 Processor-Initiated Communication with the DMAC and FDC 



Recall from section 5.1 that the processor initiates communication with the 
DI1AC or the FDC by loading the general device address FC3x onto the address 
bus. This address is transmitted to the DUAC, which tests bit 3 of the "x" 
field of the address. If this bit is high, one of the DUAC registers is 
selected, according to the value of bits 0-2, and the DUAC is prepared to 
respond to a Read or Write operation. If bit 3 is low, one of the FDC 
registers is selected. In this case, the DUAC is not prepared to respond to a 
Read or Write qperation. Instead, the DIIAC signals the FDC and the address is 
transmitted to the FDC. As when the DUAC is selected, the particular register 
of the FDC is selected according to the value of bits 0-2 of the device 
address "x" field. 

Table 5-15 lists the values used by the processor to address the DMAC and the 
FDC. Information on the individual DUAC registers and FDC registers is 
provided in sUisections 5.6.3 and 5.6.4. 



Page 51 







Table 5-15. 




General 




Operation 


Address 


Value of "X" 


AutDload 






from floppy 






di&!< 


FC5x 


"-"*"■"" 


Input- from 






FDC 


FC3x 


0-00 
0-01 
0-10 
- 1 1 


Output to 






FDt; 


FC3x 




0-0 ;i 

■ 1 

0-11 



[)nAC/FDC Addresses 



Element Selected 



DHAC AUTLD input 



Status Register- 
Track Register 
Sector Register 
Data Register 



Command Register 
Track Register 
Sector Register 
Data Register 



Input from 
or Dirtpot 
to DilAC 



FC3x 










I 




1 




1 1 




1 




1 1 




1 1 




1 1 1 



Control Register 
Status Register 
Transfer Count Loiu Register 
Transfer Count High Register 
riemory Address Loui Register 
ilemory Address Higli Register 
flemory Address Ext Register 
Interrupt Code Register 



Uhen the processor addresses the Floppy Disk Controlleri it identifies the 
particular drive to be accessed and the side of the floppy disk to be 
accessed- This information is provided in the upper byte of each command word 
loaded onto the data bus after coffmunication is established. Figure 5-3 
diagrams the contents of this luord. 



Pitge 52 



15 14 13 12 11 10 9 8 7 A 5 4 3 2 1 



ttot used 



I _„ I I I „_ I __ I I I _ _ 



Control Word Bytf? 

"Unit 1 Select Bit I 
-Unit 2 Select Bit I 

> One Uiilij 
-Unit 3 Select Bit! 
-Unit A Select Bit! 

-Side Select Bit: 

- Bide 1 

1 - Bide 2 



Figure 5-3. Format of First Data Word Transmitted to the FDC 
5.6„3 DMA Controller Organization and Operation 

The DI1AC includes several registers. Of primary interest are: 

o Transfer Count Repister. This 16-bit counter register 
holds the tuto's complement of the block size — i.e., 
the transfer count (in luords) — for DMA transfer 
Iterations. The lo»-order 8 bits are in TC Low and 
the high-order 8 bits are in TC High. This count is 
incremented after each DHA transfer. 



Address Register. This 18~bit register 
occupies 3 DMA registers: bits 0-7 are held in MA Low, 
bits 8-15 are held in PJA High, and bits 16 and 17 are 
held in ilA Ext. The carry from bit 15 to 16 is 
enabled if and only if bit 6 of the Control Register 
is set to a 1 bit. <See Table 5-16.) The Remory 
Address Register is incremented by tu>o after every DI1A 
transfer and bit is forced to 0. 

o ID Code Register. This 8-bit programmable register 
contains a code for establishing a vector address 
during a DilAC interrupt. This register is not used. 

o Control Register. This 8-bit register holds device 
programming specifications. The contents of this 
register are outlined in Table 5-16. 



Page 53 



o status Regi&ter. This i3-bjt register contains 3 
interrupt condition indicatcir bits and 5 bits mhith 
reflert the status of the Control Register. The 
contents of the Status R(?gis,ter are outlined in Tablt? 
5-17. 

Table 5-16. DHAC Control Register Contents 



Bit Name 



Function 



RUN 



When this hit is set to a 1 bit, the 
DUAC is pl.iced in run mode; when it is 
set to a bit> DIIAC operation is 
terminated , 



DEVICE 
INTERRUPT 



ThiG bit dt?termines tuhether the device 
interrupt is enabled or not- Uhen this 
bit 15 set to a 1 bit, a high on the 
DINTR input <pin 39) sets the INTR 
output (pi 1 ^0) low. 



TinE-OUT 
INTERRIPT 



3 TRANSFER COUNT 
ZERO INTERRUPT 



INPUT/OUTPUT 
WDE 



This bit controls the time-out 
interrupt. Uhen this bit is set to a 1 
bit. the time-out one-shot sets the INTR 
output <pii 40) lou>. When this bit is 
set to a bit, this interrupt is 
disabled. The time-out interrupt is set 
during a D1A transfer if REPLY- <pin 3) 
does net go lou) uiithin 5 microseconds of 
nSYNC- (pin 16) going loiu. 

This bit controls whether the transfer 
count equals zero interrupt is enabled 
or not. Uhen this bit is set to a 1 bit, 
a 7ero in the Transfer Count Register 
sets the INTR- output (pin 40) low, Uh€-n 
this bit is set to a bit, this 
interrupt is disabled. 

This bit controls the I/O direction of 
the device. When set to a 1 bit, this 
bit sets Read mode; i.e., data is 
transferred from the Floppy Disk 
Controller to memory. When set to a 
bit, this bit sets Write mode; i.e., 
data is transferred from memory to the 
Floppy DiEk Controller. 



Pc-ge 5A 



HOLD BUS 



Uhen this bit is set to a 1 bit* the 
DUAC retains control oF the data bus 
throughout the transfer of the entire 
block. When this bit is set to a bit, 
the OriAC releases the data bus after 
each i»ord transfer. 



ADDRESS 
EXTENSION 
CARRY ENABLE 



Uhen set to a 1 bit, this bit allows a 
carry from DllA address bit 15 to 
propoxate into bit 16. Uhen this bit is 
set to a bit, address extension carry 
is disabled. 



This bit is not used. 



Table 5-17, DUAC Status Register Contents 



Bit Name 



Function 







BYTE OR WORD 



This bit indicates the status of the BOU 
input <pin 36). This bit is always set 
to a bit, indicating that word mode is 
in effect. In word mode, the DtlA memory 
address is incremented by two (bit is 
forced to a bit) after each DHA 
transfer. Bit is a read-only bit. 



Page 55 



DEVICE 
INTERRUPT 



This bit is set to a 1 bit when a device 
interrupt condition occurs. Resetting 
this bit to a bit resets the IHTR- 
output (pin 40). Bit 1 is a read/write 
bit. 



TirE-OUT 
imERRUPT 



This bit is net to a 1 bit when a 
time-out interrtpt condition occurs. 
Resetting thris bit to a bit resets t-he 
INTR- output (pin 40). Bit 2 is a 
read/write bit. 



TRANSFER COmi 
ZERO INTERRUPT 



This bit is set to a 1 bit when a 
transfer count equals zero interrupt 
condition occurs.. When set^ this bit 
sets the EOB oui;put (pin 38). This bit 
is set to iBheti the Transfer Count 
Register is loaded with a non-zero 
value. Bit 3 U. a read-only bit. 



INPUT/OUTPUT 
MODE 



HOLD BUS 



This bit reflects the status of bit 4 in 
the Control Register. When this bit is 
set to a 1 bit> the DflAC operates in 
Read wodei »hen it is set to a 0, the 
DttAC operates in Write mode. Bit 4 is a 
read-only bit. 

This bit reflects the status of bit 5 in 
the Control Register. When this bit is 
set to a 1 biti the DUAC retains control 
of the data bus throughout an entire 
block transfer. When this bit is set to 
a bit, the DUAC releases the bus after 
each word transfer. Bit 5 is a read-only 
bit. 



ADDRESS This bit reflects the status of bit 6 in 
EXTENSION CARRY the Control Register. When this bit is 
ENABLE set to a 1 bit> a carry is allowed from 
DMA address but 15 to prt^agate into bit 
16. When t^is bit is set to a bit, 
address esctensian carry is disabled. 
Bit 6 is a read-only bit. 



BUSY 



This bit reflects the status of bit of 
the Control Register. When this bit is 
set to a 1 bit, the DflAC is in run 
mode. When this bit is set to a bit, 
DHAC operation is terminated. In the 
Status Register, BUSY is a read-only 
bit. 



?age 56 



When the DilAC is in run mode, it luaits for a Data Request input Prom the FDC. 
When a request is received, the DI1AC requests control of the data bus from the 
processor. Once this request is granted, the DhAC controls data transfers 
betttjeen the FDC and memory. The direction of the transfer is determined by 
the status of the R/U output <pin 17), which is tied directly to bit 4 of the 
Control Register. 

Three interrupt conditions can occur during DHAC operation: 

o Device Interrupt. This condition occurs luhen the 
DINTR input <pin 39) is made high. A device 
interrupt occurs UJhen the device requires service, 
when a failure occurs, drfien a task is completed, or in 
other situations. 

o Transfer Count Equals Zero. This condition occurs 
when the Transfer Count Register is incremented to 0. 

o Time-Out Interrupt. During a DPIA transfer, tfie 
leading edge of the HSYNC- output (pin 16) triggers an 
internal time delay of about 5 microseconds. If the 
DHAC does not receive an active low REPLY- input (pin 
3) within that time delay, a time-out interrupt 
condition occurs. 

If any of these conditions occurs, the corresponding bit in the Status 
Register is set and the Status Register RUN bit is reset. If the appropriate 
enable bit in the Control Register is set, the INTR- output (pin 40) is made 
active. 

For more information on the DI11883 device, see the "Dni883A/B Direct Memory 
Access Controller" data sheet, available from Western Digital Corporation. 



Page 57 



!>»6-4 Floppy Disk Controller Organization and Operation 

The Floppy Disk Controller includes several registers. Of primary interest 
arc?: 

o Data Shift Register. This i3-bit register assembles 
serial data froBi the RAU READ- input (pin 27) during 
Read operations and transfers serial data to the 
WRITE DATA output (pin 31) during Write operations. 

o Data Register. This OHjit register is used as a 
holding register during Disk Read and Write 
operations. In Disk Read operations, the assembled 
data byte is transferred in parallel to the Data 
Register from the Data Shift Register. In Disk Write 
operations, information is transferred in parallel 
from the Data Register to the Data Shift Register. 
In a Seek operation, the Data Register holds the 
address of the desired Track position. (The Disk 
Read, Disk Write, and Seek operations are described 
later in this subsection.) 

o Track Register. This B-bit register holds the track 
number of the current Read/Write head position. This 
register is incremented by 1 each time the head is 
stepped in (toward track 76) and decremented by 1 
each time the head is stepped out (toujard track 0). 

o Sector Register. This 8-bit register holds the 
address of the desired sector position. 

o Command Register. This 8-bit register holds the 
command currently in execution. 

o Status Register. This H-bit register holds device 
status information. 

o CRC Logic Register. This lojic is used to check or 
generate the 16-bit Cy<:lic Redundancy Check (CRC). 
The polynomial is: 

16 12 5 
F(x) = X + X + X t- 1 

The CRC includes all information starting with the 
address mark up to the CRC characters. 

When data is read from a floppy disk, it passes through the Data Separator, a 
counter separator comprised of twj irtegrated circuits. The Data Separator is 
located on the board as shown in Figure 5-1. 

The Data Separator logic serves to de-rive the flux transition spacings from 
the raiB data; this rate is then suppj.ied to the RCLK- input (pin 26). The raiu 

Piige 58 



data is supplied to to the RAW READ- input (pin 27). Essentially, any 
transition on RAW READ- loads the Data Separator counter. When this counter 
reaches Oi the RCLK flip/flop is togigled. 

The Floppy Disk Controller accepts 11 commands* grouped into A types. The 
following paragraphs describe the command types and the individual commands 
within each type. 

Type I commands include the Restore, Seek, Step, Step In, and Step Out 

commands. Each of these commands includes a rate field (bits and 1) which, 

in conjunction with the frequency of the CLK input, defines the stepping 
motor rate, as outlined in Table 5-18. 

Table 5-18- Stepping Motor Rates for FDC Type I Commands 



CLK Frequency 


Rate 


Field 


Value 


Rate Selected 


2 nHz 






1 

1 
1 1 




3 ffls 

6 ffls 

12 ms 

15 ms 


1 mz 






1 

1 
1 1 




6 ms 
12 ms 
20 ms 
30 ms 



Bit 2 of all Tiflje 1 commands is a verification flag. If this bit is set to a 
1 bit, a verification operation is performed on the destination track. If 
this bit is set to a bit, no verification is performed. 

The Type I commands also contain a head load flag in bit 3. If this bit is 
set to a 1 bit, the ReadAlrite head is loaded - - i.e., the HLD output (pin 
28) is made active ™ at the beginning of the command. If bit 3 is set to a 
bit, HLD is deactivated at the beginning of the command. Once the head is 
loaded, it remains engaged until the FDC receives a command which specifically 
disengages the head. Or, if the FDC is busy for 15 revolutions of the disk, 
the head is disengaged automatically. 

The Step, Step In, and Step Out commands include an update flag in bit 4. When 
this bit is set to a 1 bit, the Track Register is updated by 1 for each step. 
When this bit is set to a bit, the Track Register is not updated. 

The Type I commands are: 

o Restore. If the Read-Write head is positioned over 
track when this command is received, the Track 
Register is loaded with zeros and an interrupt is 
generated. Otherwise, stepping pulses at the 

Page 59 



specified rate (see Table l>~17) are issued until the 
head is located over track 0. 

Seek. This command assun>es that the Track Register 
contains the track number oi'- the Read-Write head's 
current position and that the Data Register contains 
the desired track nmrtjer. Stepping pulses in the 
appropriate direction are isuued until the contents of 
the Track Register are equal i;o the contents of the 
Data Register. 



o Step. This command causes the FDC to issue 



one 



stepping pulse to the disk drive in the same direction 
as the previous Step* Step In^ or Step Out command. 
(At least one St^ In or Step Out command must be 
executed before a Step command is received.) 

o Step In. This command causes the FDC to issue one 
stepping pulse in the direction toward track 76. 

o Step Out. This command causes the FDC to issue one 
stepping pulse in the direction toward track 0. 

Table 5-19 summarizes the Command Register values for Type I commands. 

Table 5-19. FDC Command Register Values for Ti^e I Commands 



Command 


Command Register Value 


Restore 


h 


V rl r2 


Seek 


1 h 


V rl r2 


Step 


1 u h 


V p1 r2 


Step In 


1 u h 


V Pl r2 


Step Out 


1 1 u h 


V rl r2 




ttjhere: 


h - head load flag: 

1 - load head at beginning 
of command 

- unload head at beginning 

of command 
u - update flag: 

1 - update Track Register 

- do not update Track 

Register 
V - verification flag: 

1 - verify on last track 
- do not verify 

? 1 and r2 - stepping motor rate 
(see Table 5-18) 



Page 60 



Table 5-20 lists the Status Register contents when a Type 1 command is executed- 
Table 5-20. FDC Status Register Contents for Type I Commands 



Bit Name 



Meaning 



BUSY 



1 INDEX 



2 TRACK 00 



3 CRC ERROR 



^ SEEK ERROR 



5 HEAD LOADED 



6 PROTECTED 



When set to a 1 bit* this bit indicates 
that command execution is in progress, 
l-Jhen no command execution is in 
progress* this bit is set to a bit. 

This bit is set to a 1 bit when an index 
mark is detected on the drive; 
otherwise, this bit is set to a bit. 
This bit is an inverted copy of the IP 
input <pin 35). 

This bit is set to a 1 bit when the Read- 
Write head is positioned to Track 00; 
otherwise* this bit is set to a bit. 
This bit is an inverted cqf>y of the TROO 
input (bit 3A). 

This bit is set to a 1 bit when CRC 
characters are encountered in an ID 
field; otherwise* this bit is set to a 
bit. 

This bit is set to a 1 bit when the 
desired track was not verified; 
otherwise, this bit is set to a bit. 

This bit is set to a 1 bit when the Read- 
Write head is loaded and engaged; 
otherwise* this bit is set to a bit. 
This bit is the logical Ahff) of the HLD 
output (pin 28) and the HLT input (pin 
23). 

This bit is set to a 1 bit when Write 
Protect is activated; otherwise* it is 
set to a bit. This bit is an inverted 
copy of the WRPT- input (pin 36). 



Page 61 



HOT READY This bit; is set to a 1 bit if the drive 

is not ready. If the drive is ready* this 
bit is &et to a bit. This bit is 
,jn inverted copy of the READY inpirt (pin 
32), looically OReri with the IIR- input 
<pin 19). 



The Type 11 commands are Read Sector and Write Sector. Prior to loading a 
Type II command into the Command Register, the processor loads the desired 
sector number into the Sector Register. When a Type 11 command is received 
and an ID field is located on the disk/ the track number of the ID field is 
compared ©ith the Track Register. If they do not match, the next ID field is 
read. If there is a match, the sector number of the ID field is compared u;ith 
the Sector Register. If they do not iratch, the next ID field is read. If 
there is a match, the CRC of the ID field is tested. If the CRC is incorrect, 
the next ID field is read. If the CRC is correct, the data field is then 
located and its contents are either read or written. The FDC must find an ID 
field with the correct track number, sector number, and CRC uiithin fotjr 
revolutions of the disk. 

The Type II commands each provide Placis for requesting a 15 -microsecond delay 
before the Read-Write head is loade-d against the medium, and for specifying 
that multiple sectors are to be read or u»ritten. The Write Sector command also 
provides a flag for controlling the writing of the data address mark. 

The Ti^e II cc»nmands are: 

o Read Sector. This command causes the data field 

associated with the selected ID field (correct track 

number, sector nurtber, and CPC) to be presented to the 
processor. 

o Write Sector. This comittanti causes the FDC to write 
data bytes from the Data Siiifl: Register to the data 
field of the selected 5ec1;or (correct track number, 
sector number, and CRC). 

The iCommand Register values for Type ::i commands are listed in Table 5-21. 



l*aje 62 



Table 5-21, FDC Command Register Values for Type II Corofi»and& 



Coomtand 



Command Register Value 



Read Sector 
Urite Sector 



1 m - e 
lOlro-e-a 



where: m - multiple record flag: 
1 - multiple records 

- single sector 

e - head loading delay flag: 

1 - 15-ms delay 

- no delay 

a - data address mark flag: 

1 - F8 (Deleted Data hark) 
- FB (Data Hark) 



The contents of the Status Register have the same meanings on a Type II 
command as on a Type III command. The Status Register contents for Type II 
and III commands are described in Table 5-23, presented after the discussion 
of the Tipe III commands^ 

The Type III commands are: 

o Read Address. This command causes the 6 bytes of the 
next encountered ID field to be assembled and 
transferred to the Data Register. The ID field bytes 
are: track address* side number, sector address, 
sector length, CRC 1, and CRC 2. 

o Read Track. This command causes reading to begin with 
the leading edge of the next encountered index mark 
and to continue until the next index pulse. As each 
byte is assembled, it is transferred to to the Data 
Register. 

o Write Track. This command causes bytes from the Data 
Register to be written to the disk, starting with the 
leading edge of the next encountered index pulse and 
continuing until the next index pulse. 

Table 5-22 lists the Command Register values for Type III commands. 

When a Type II or Type III command is executed, the contents of the Status 
Register are as listed in Table 5-23. 



Page 63 



Table 5-22. FDC Command Register Values for Type III Commands 



Command 



Command Regijiter Value 



Read Address 
Read Trsck 
Write Track 



110 10 
1110 10- 
11110 10 



Table 5-23. FDC Status Register Contents for T»pe II 
and Ti^e III Commands 



Bit Name 



leaning 



BUSY 



When set to a 1 bit. this bit indicates 
that a command is under execution, IF 
no commend is under execution, this bit 
is set to a bit. 



1 DATA REQUEST 



This bit is a copy of the DRd output 
(pin 38). When set to a 1 bit> it 
indicates that the Data Register is full 
on a Re£id operation or empty on a Write 
oper.jticin. Otheruiise. this bit is set 
to a tit. 



LOST DATA 



This bil; is set to a 1 bit if the 
processor does not respond to a DRQ 
signal <pin 38) in one byte time. 
Otheruri!ie. this bit is set to a bit. 



CRC ERROR 



This bi1; is set to a 1 bit if an error 
IS found in one or more ID fields or in 
the datii field. Otherwise* this bit is 
set to i\ bit. 



RECORD TYPE/ 
WRITE FAULT 



On a Reiid Sector command, this bit 
indicati.'s the record-type code from the 
data field address mark. On any Write 
command; this bit is set to a 1 bit if a 
wite fiiult occurs. This bit is not 
used by the Read Track command. 



Page 6^ 



WRITE PROTECT 



On any Write command* this bit is &et to 
a 1 bit if Write Protect is active? 
otherwise* it is set to a bit. This 
bit is not used by the Read Sector or 
Read Track command. 



NOT READY 



This bit is set to a 1 bit if the drive 
is not ready. If the drive iri ready, 
this bit is set to a bit. This bit iE> 
an inverted copy of the READY input (pin 
32), logically ORed tuith the? MR input 
(pin 19). 



Type IV consists of a single command: the Force Interrupt command. If another 
command is under execution when the Force Interrupt command is loaded into the 
Command Register, that command is terminated. Depending on the value of bits 
0-3 of the Command Register, an interrupt may be generated- Table 5-2'*? lists 
the Command Register values for the Force Interrupt Command. 

Table 5-24. FDC Command Register Values for the Force 
Internet Command (Type IV) 



Command 



Command Register Value 



Force Internet, no 
interrupt generated 



110 10 



Force Interrupt, htot- 
Ready to Ready Transi- 
tion interrupt generated 



110 10 1 



Force Interrupt, Ready 
to Not-Ready Transition 
interrupt generated 



110 10 10 



Force Interrqat, Index 
Pulse interrupt generated 



110 10 10 



Force Interrupt, Ifflfl»ediate 
Internet generated 



110 110 



Page 65 



If a Force Interrupt command is received while another command is under 
execution, the Status Register BlISY bit (bit 0) is reset and the rest of the 
Status Register bits are unchanged. If a Force Interrupt command is received 
uihile no other command is being executed* the BUSY bit is reset and the rest 
of the Status Register bits are updated or cleared. In this casp> the Status 
Register bits have the same meariings as on a Type I command, as outlined in 
Table 5-20. 

For more information on the FD17?1 Floppy Disk Controller, see the "FD1791/2 
Floppy Disk Controller" data sheet, available from Western Digital Corporation- 



Page 66 



THE niCROEWGINE COHPANY 



tm 
Pascal tllCROENGINE Computer 



Pascal Operations tianual 



Prelimiviary Edition 
rtarctw 1V79 



Software is provided on a licensed basis only and is the property of the 
University of California luith permission pranted for use on an individual 
syr^tem basis only. Copies may be made for archival purposes only. 

Information furnished by The MICRCEICINE Company is believed to be accurate 
and reliable. However, no ret-ponsibility is assumed by The IlICROENGINE 
Company for its use; nor for any infringements of patents or other rights of 
third parties which may result from its use. No license is granted by 
implication or otherwise under any patent or patent rights of The iUCROENGINE 
Company. The niCROENGINE Company reserves the right to change product 
specifications at any time without notice. 



Copyright <c) 1979 by The niCROENGINE Company 
First Printed March 1979 
All ricihts reserved. 



No part of this document may be reproduced by 
any means* nor trenslated. nor transmitted 
into a machine language without the written 
permission of The I1ICF0ENGINE Company. 

niCROENGINE is a Registered Trademark of 
Western Digital Co'fporation. 

The niCROENGINE Company is a wholly-owned 
subsidiary of Uest-ern Digital Corporation. 



PREFACE 

This manual is organized primarily for reference purposes. The first section 
.gives a brief overview of the Pascal Operating System. Section 2 gives 
details, including commands, of each of the separate parts of the system. 
Section 3 deals with Pascal programming considerations necessary to function 
(uithin the system. Section 4 describes the utilities available^ Appendices 
are for quick reference capability. 



Ki^KKK 



This manual was prepared and edited using the 
UCSD Pascal Screen Oriented Editor and was 
printed using a PRINTRONIX ilodel P300 
lineprinter. The lineprinter uias provided by 
PRINTRONIX Corporation, Irvine, California. 



WESTERN DIGITAL 
PASCAL OPERATIONS I1ANUAL 
OUTLINE 



Pape 



Section 1 INTRODUCTION , . 1 

Section 2 PASCAL OPERATING SYSTEn „ „;j 

2.1 The Operating System Hierarchy „,,»,3 

2.2 Outer Level CommandB. ........,.,,...,..., , ./] 

2. ^ Screen-Oriented Editor. .,...„... „ , 6 

2. A. 1 Moving Commands. ................6 

2. A. 2 Text-Changing Commands B 

2. 4. 3 Formatting Commands » , 1L> 

2.4.4 Hiscellaneous Commands. .....»..,...,,.„. .,16 

2.4„5 L2 Editor „ .. xy 

2.5 Yet Another Line-Oriented Editor (YALOE) ..22 

2.5.1 Special Key Commands. .-».. „ „...2::j 

2. 5. 2 Input/Output Commands. ....»,..,.....,.„„.. 24 

2. 5. 3 noving Commands. ............................... 26 

2. 5. 4 Text-Changing Commands ^ 2B 

2.5.5 Hiscellaneous Commands 30 

2. 6 Fi le Hand ler. „ , , 32 

2.6.1 "F" Prompt Line Commands 33 

2.6.2 "?" Prompt Line Commands............ 39 

2.7 Pascal Compiler... 43 

2.7-1 Compiler Option Syntax. ............45 

2. 7. 2 Cofliq»i ler Options. 45 

2.8 Basic Compiler. .....49 

2.8.1 Features of UCSD Basic .49 

2. 8. 2 UCSD Basic Enhancements. 53 

2.9 Linker. . .......,....,..,....„.., 53 

2,9.1 Using the Linker.. ....54 

2-9,2 Linker Conventions and Implementation... 55 

2. 10 Debugger 57 

2. 10. 1 Debugger flodes. ^^ 

2. 10.2 Commands. 59 

Section 3 PASCAL PROGRAIIilING CONSIDERATIONS 63 

3. 1 Intr insics. 63 

3.1.1 Character Array Manipulation Intrinsics, .......64 

3.1.2 I/O Intrinsics ..........66 

3.1.3 String Intrinsics... ..,...,...69 

3.1.4 Hiscellaneous Intrinsic Routines.... 71 

3. 2 Fi les. ..................„......,....,..,.„..,„,,, ..72 

3.2.1 Text Files 72 

3.2.2 Code Files 72 

3.2.3 Data Files 73 

3.2.4 Foto Files , 73 



3.2-5 Bad l-ilcs... - ^''i 

3.2.6 Work Files ?'3 

3.2.7 Volumes 73 

3. 2- 3 Fi le Manies - 7'j 

3. 3 Segmc'Tits, 7'J 

3. A Link ages 76 

3.-^.1 Pascal to Pascal Linkages (Units)...., ..,.76 

3. 5 Long Integers,. 7V 

3.6 UCSD Pascal Enhiincements.... 00 

3. 6. 1 Case Statements. ....... .... BO 

3. 6. 2 Coffiflienti, ...,„»....... 81 

3.6-3 Dynamic tiemory Allocation.. ..,.,.,..... ..81 

3.6. '^ e6f(F) , ..81 

3.6-5 E:a.N<f) 02 

3. 6. 6 Fi les - 82 

3.6.7 GOTO and EXIT Statements..., .................. .8^ 

3.6-8 Packed Variables .,.....,. m 

3,6-9 Parametric Procedures and Functions ...87 

3.6-10 Program Headings.. .....,....-.„--....... .87 

3.6-11 READ and READLN „.,..........-. .87 

3. 6. 12 RESET< f ; - 88 

3.6. 13 REWRITE ;f) 83 

3. 6. lA Segment Procedures. ............................ 88 

3. 6. 15 Sets 8V 

3. 6. 16 Strings, 8V 

3.6.17 WRITE and WRITELN 90 

3.6.13 Implementation Size Limits .-90 

3.6-19 Extended Comparisons............ - VI 

Section A UTILITY PROGRAHS .,-,-.... ...93 

A. 1 Setup 93 

4-1.1 tliscell.jneous Information.-......--..... .93 

4-1-2 General Terminal Information - 93 

4-1.3 Control Key Information .-....,..-. .94 

4.1.4 Video Screen Control Characters 96 

4. 2 Bootstrap Copier 97 

4.3 Duplicate Directory Utilities .,.-....97 

4.4 Librarian...... . , ....98 

4. 5 Library Oap 99 

4.6 P-Code Disassembler .99 

4. 6. 1 P-Ccde Jisassemb ler 99 

4.6.2 Data Segment Reference Statistics. .-.-...-.... 100 
4.6-3 Opcode, Procedure Call and Jump Statistics. ...102 

4. 7 Patch/Dump .-....-.--....... 102 

4. 7. 1 Console Mode. ..-.-.,..,,... 102 

4.7.2 Patchiuork ilode 103 

4-7-3 Wholeiuriter ilode ..,.„..-.-... 104 

4.8 Ca leu lator 104 

4.9 GOTOXY Procedure Binder -.106 



APPENDICES 

Appendix A Command Summaries. <,.......................„...„...„ 107 

A. 1 Outer Level. 107 

A. 2 Screen Oriented Editor. ................................ 107 

A. 3 YALOE 1 00 

A.4 File Handler „ 109 

A. 5 Pa&cd 1 Compi ler. 1 10 

A. 6 Debugger. 1 .11 

Appendix B Tab les. IIU 

B. 1 Runtime Errors. ....................................... .113 

B-2 Syntax Errors Version 3. ........................ ^......ll'i 

B. 3 I/O Results , 117 

B.^ Unit Ntwbers 117 

B.S P-ilachine Op Codes Version 3 , lie 

B.6 Assembler Syntax Errors............................. ...127 

B.7 ASCII Codes , 129 

Appendix C UCSD Pascal Syntax Diagrams. ..„ „ 131 

Appendix D Glossary. .................................................... 13^ 

ILLUSTRATIONS 

2-1 Operating System Overvieuj, ...3 

2-2 Examp le of Auto-Indent. ..,...,...,....,.,„...... 9 

2-3 Example of Delete Command 10 

2~A Examp le of Exchange. 12 

2~b Examp le of Rep lace. ................................................ ILi 

2-6 Example of ilargin. 16 

2-7 Examples of tloving Commands ................20 

2 --8 Examp les of Text-Changing Commands. ................................ 29 

2-9 Example of Macro Command..................................... .>...,. 32 

2-10 Fi le Specification 33 

2-11 Example of Compiler Display. .......................................45 

2-12 Example of Compiled Program Source Listing. ..,...«,..,,...,..,..,,. !>/ 

2-13 Example of Entering Examine llode. ...................SO 

2-14 Using Debugger Commands to Debug a Program. ....60 

3-1 Examples of Character Array Manipulation Intrinsics. ...............65 

3-2 Examples of String Intrinsics.... 70 

3-3 I/O Devices. , , 75 

3-4 Syntax for a Unit Definition., , 78 

3-5 Example Uses of Long Integers. ......,,,.. 80 

3-6 Example of Fallthrough in a Case Statement. ........................81 

3-7 Using ilark and Release to Change Heap Size. ...82 

3-8 Example of Using Untyped Files. ....................................84 

3-9 Example of using the Exit Statement... ,.,.,,,,..85 

3-10 Examples of Packed Arrays and Records. ............86 

3-11 Examples of Set Comparisons. 89 

4-1 Disassemb ly Examp le. 101 

4-1 Ca Iculator Examples. .............................................. 105 



SECTION 1 

INTRODUCTION 

The Pascal Operating System described in this document is designed to run on 
the tllCROENGINEtffi computer- For optimum use of the system, a CRT is 
recommended for use as the operator's console, The Pascal language used in the 
system is the modification of Standard Pascal developed at the Unjv/cjrsity of 
California, San Diego <UCSD Pascal). 

The Operating System consists of a number of modules, each designed for a 
particular program control purpose- These modules are accessed by commands 
that are displayed in a prompt line on the operator's console. As each 
module is accessed, it generates the display of a prompt linf? giving the 
commands that are to be used in it. The modules are: 

o Editor (either for a CRT or line-oriented console) 

o File Handler 

o Pascal Compiler 

Basic Compiler 

o Linker 

o Debugger 

Basic to the design of the system is the "luork file", luhich is an area used 
for program development. Only one u)ork file area is provided by the system. 
If another is needed, the contents of the work file may be saved under a 
separate file name for later reference (see Section 2.6, File Handler, the 
S(ave command). However, any number of files can be retrieved and combined 
into one work file. 

This document was written with the assumption that the user is already familiar 
with the Pascal language and using computer systems. The following documents 
will provide supplemental information on both Pascal and this system: 

o Pascal User Manual and Report (Standard Pascal) 
Kathleen Jensen and Niklaus Wirth 
Springer-Verlag, New York, (c)1975 

o Microcomputer Problem Solving Using Pascal 
Kenneth L. Bowles 
Springer-Verlag, New York, (c)1977 

o Pascal MICROENGINE Computer User's Manual 



Page 1 



SECTION 2 
PASCAL OPERATING SYSTEfl 



2«.1 THE OPERATING SYSTEI1 HEIRARCHY 

The Pascal Operating System has what can be described as a tree -like structure. 
The root of the tree corresponds with the outer level. Commands from the 
root reijch out to activate the leaves* or lower levels of the system. 
Figure 2-1 diagrams this tree-like heirarchy. 



OPERATING SYSTEH OVERVIEW 
Outer Commands: E(dit/ F(ile* R<un» C(omp* L<ink> X(ecute, [Xebug 

-Edit: A<djust* C<py* D(lete> FCind. Knsrt, J<mp» R (place* Q(uit* X(chng* Z<ap 

-Filer: G(et> S(ave. W<hat» N(eu», L(dir> R(em, C(hng/ T(rans* D(ate* Q(uit 

— Run: Invokes the Compiler* Linker and executes the program, 

— Compile: Translates Pascal source programs into P-code. Options are placed 
in program text. 

-Link: Links the system library to translated program, 

"Execute: Executes compiled and linked programs. 

—Debug: Interactive program mhich aids in debugging executing programs. 

The UC^ Pascal Operating System is a single user program development system 
which aids in developing and executing user application programs. 

Figure 2-1. Operating System Overview 

The lower levels of the system are accessed by outer level commands. A 
command structure within each level enables the user to direct its execution. 
The commands are listed in a pron^t line. The prompt line for the outer 
level commands appears after Autoload* after execution of a lower level* and 
following the entry of some lower level commands* such as Q<uit in the File 
Handler. Within each of the lower levels* infrequently used commands may 
not appear on the prompt line if there is insufficient room on the line. 



Page 3 



Tlie loajer levels of the Pascal Operating System are: 

o Screen -Oriented Editor -- An editor specifically 
designed for use ujith video display terminals to 
insert or delete text in the luork file or any tfxt 
file. 

o Line-Oriented Editor ( ITALOE) - An editor 

specifically designed for use with teleprinters to 

insert or delete text in the work file or any text 
file, 

o File Handler - Used primarily for maintenance of 
files stored on the disk. 

o Pascal Compiler - A one -pass compiler used to 
compile programs. 

o Basic Compiler - Used to compile programs. 

o Linker - Used to combine prerompiled files* written 
in Pascal . 

o Debugger - Used to facilitate debugging. 

^kJrfflally* an installation will have Just one of the editors and one of the 
compilers/ depending on system configuration and need. 

Other functions are available as utilities. These include the desk calculator, 
the patch/dump utility, the terdiinal configuration setup program and a 
bootstrap mover. 

2.2 OUTER LEVEL COTIflANDS 

The prompt line for the outer level commands appears automatically after 
Autoload and after any of the lower levels have completed execution. 
The prompt line offers a command for each of the other levels of the 
operating system. The format of the prompt line is: 

Command: E(dit> R(un, F(iler, C(omp, L(ink, X(ecute, D<ebug 

The operator invokes the execution of the individual com^nands by entering 
the capitalized character on the operator's console. The function of each 
command is as follows: 

E(dit 

By entering an "E", either the Screen-Oriented 
Editor or the Lire-Oriented Editor (YALCJE) is 
brought into memory from disk, depending on 
whether a CRT or a teleprinter is used as t^he 
operator's console in the system. The work file 
text is read into the Editor buffer 
automatically if one is present. Otherwise, the 
Editor prompts for a file. 

I* age ^ 



R(im 



Entering an "R" causes the code file associated 
with the current tt»ork file to be executed. If a 
code file does not currently exist* the system 
Compiler is called automatically. If the 
compilation requires linkage to separately 
compiled code* the Linker also is called 
automatically and assumes the use of the file 
KSYSTEM. LIBRARY. The program is executed after 
a successful compilation and linkage. 



F<ile 



Entering an "F" calls the 
memory from disk. 



File Handler into 



C(oii^ 



Entering a "C" initiates either 
Compiler or the Basic Compiler* mf 
part of the system. 



the Pascal 
i<:hever is a 



L<ink 



X<ecute 



D(ebug 



The "L" command starts the Linker to allow users 
to link routines from libraries other than 
KSYSTEn. LIBRARY. 



After an "X" command is entered* the user is 
prompted for the file name of a previously 
compiled code file. If the file requested 
exists* it is executed. Otherwise* the message 



'can't find file" is returned. 



(Note: The 



".CODE" suffix on such a file is implicit and 
does not need to be entered.) If the code file 
is composed of several separately compiled 
files* and one part has not been linked* the 
message "file <fileid> not linked in" is 
returned. Programs can be executed either by 
use of X<ecute for a file that has already been 
ccwipiied or by use of F<ile* G<et the file* 
Q(uit the Filer, and then R<un the program. 



Entering a "D" causes the current work file to 
be executed. If the program in the work file has 
not been compiled* the Compiler will be called 
first* as with the R(un command. During 
execution* if a runtime error occurs or if a 
user- defined breakpoint or halt is encountered* 
the Debugger is called. 

The X(ecute command can be used to execute utility functions. These 
functions include a desk calculator* a librarian and library map* and a 
G01DXY procedure binder* among others. These are described in Section A. 



Page 5 



2,. 4 SCREEN-ORIENTED EDITOR 

The Screen-Oriented Editor is desigrieil to provide a mindou) into the file uiith 
the video display terminal. The aiindou* shotus that portion of the Pile in which 
editing is taking place. When enterit.g any file* the Editor displays the start 
of the file in the upper left corne?r of the screen. That is u>here the cursor 
is originally positioned* also- The cursor is a marker that indicates where 
the action is taking place. When the user enters an Editor command to go to 
a part of the file that is not displa^jed* the u>indou» is updated to shout that 
portion of the file. Thus* the user does not need to operate on any portions 
of the text that are not seen on the screen; however* he has the option to 
do so. 

When the Editor has been called by centering the outer level "E" comwand* tite 
Editor displays a prompt line at the top of the screen. The prompt line 
reminds the user of the current mode .jnd the options available for that mode^ 
Only the most commonly used options appear on the pron^t line. The format 

is: 

>Edit: A<dju5t C<py Ddete f(ind Knsrt J(mp R(place Q(uit X<chng Z<ap 

Note that the cursor is never really "at" a character position; it is 
between the character where it appears <for ease of display) and the one 
immediately preceding. This is most clearly noticed in the Knsrt command 
which inserts in front of the charact<?r at which the cursor is located. 

In the Editor* some of the options ari= referred to as commands and some as 
modes. l#jen an option executes a task and returns control to the Editor* 
that option is called a command. Uhei an option issues a prompt for another 
level of options* it is called a mode. On entering or returning to the edit 
level* the Editor always displays the "Edit " prompt line. 

Repeat factors are allowed by any of the commands to repeat the action of 
the command as many times as indicate! by the immediately preceding number. 
For example* entering 

2 < down-arrow) 

will cause the < down-arrow) command to be repeated twice* moving the cursor 
down two lines. The assumed repeat factor is 1 if no number is typed before 
the command. A slash (/) typed before the command indicates an infinite 
number of repeats. 

Some commands are directional. If their direction is forward* they operate 
forward through the file* if backuiards* they operate in the reverse. Uhen 
direction affects the commands* it is specifically noted. 

.2.4.1 Moving Commands 

The moving commands move the cursor from one location to another to position 
it for the next editing function. Many of these commands are initiated by 
keys on the CRT keyboard. They incluje: 



Page 6 



Comffland/Key Function 

< doum-arrow > Moves cursor down 

<«4J-arro»B> ttoves cursor up 

<right-arrou)> Hoves cursor right 

< left-arrow > Moves cursor left 

"<" or "," or "-" Changes the direction to backward 

">" or "." or "+" Oianges the direction to forward 

< space) Moves direction 

< back -space) Moves left 

< return) Moves to the beginning of the next line 

Direction is always indicated by an arrow <) or <) in front of the prompt 
line. The direction is forward when the Editor is entered; but can be 
changed by typing the appropriate command whenever the "Edit: " prompt line 
is present. On many standard keyboards* the period <.) can be used for 
forward because it is the lower case for ")"; and the comma <*) can be used 
for backward* being the lower case for "<". 

Repeat factors can be used with any of the keyboard commands given above. 

The Editor maintains the column position of the cursor when executing the 
< up-arrow) and < down-arrow) commands. When the cursor is outside the text* 
the Editor treats the cursor as though it were immediately after the last 
character or before the first in the line. 

The moving commands that do not have special function keys on the CRT keyboard 
are jump* page and equals. They are described below. 



>xM1P 



JW1P mode is entered by typing "J" for J<mp. Uhen the 
jyiP mode is entered* the prompt line appears: 

JUMP: B<eginning E<nd M(arker <esc> 

Entering "B" or "E" moves the cursor to the beginning 
or end of the file* displays the "Edit:" prompt line 
and the first or last page of the file. Entering "M" 
produces the prompt line: 

Jump to what marker? 

The user then enters the name of the marker* followed 
by a (return). The Editor moves the cursor to the 
place in the file where the marker having that name 
was previously set. If a marker of that name is not 
in the file* the error message displayed will be: 

ERROR: Marker not there. Please press < space-bar) 
to continue. 

The instructions for setting a marker in a file are 
given in Section 2.4.4* Miscellaneous Commands* under 
Set. 

Page 7 



PM^ 



EmiAlS 



The PAGE command is executed in response to typing 
"P". PAQE moves the cursor on? whole pa^e up or doom* 
depending on the direction of the arrow at the 
beginning of the prompt line. The cursor (noves to the 
start of the top line. To nove several pages at one 
timci the repeat factor may be used with this command. 



The EQUALS command is executed in response to "=". It 
makes the cursor jump to the beginning of the last 
section of text that was inserted* found or replaced 
from anyiuhere in the file. EQUALS uiorks from 
anywhere in the file and is not direction-sensitive^ 
When an INSERT, FIND or REP-ACE command is executed., 
the beginning of that function is saved. Howeverj if 
a copy or deletion has been made between the beginning 
of the file and that absolute position, the beginning 
location is altered and as no longer correct for an 
EQUALS command. 



2. '^-2 TEXT-CHANGING CCBIHANDS 

The commands described below change the text of the file. 

INSERT 

INSERT mode is entered by typing "I" for Knsrt. When 
the INSERT mode is entered, the prompt line appears: 

Insert: Text{<bs> a char, <del> a line> r<etx> 
accepts, <esc> €fscapes3 

The text to be inserted is typed in. It may be 
followed immediately by <Btx> or <e5c>. Before 
insertion, a character can be deleted by backspacing 
<<b5> a char) or an entire line can be deleted (<del> 
a line). 

A new line can be started at a level of indentation 
set by options in the SET mode by typing: 

< return > 

Direction does not affect the INSERT mode, but is 
indicated by the arrow in the first position of the 
prompt line. 

An insertion that is made and corrected is available 
for use in the COPY mode. Homever, if <esc) is used, 

Page 8 



no string is available for COPY. 

AUTO-INDENT and FILLING 

AUTO-INDENT and FILLING are used to control the left 
and right margins, respectively. Both are in effect 
if True and not in effect if False. (See BET for 
setting them to True or False.) 

If AUTO-INDENT is True, a < return) causes the next 
line to start at the same level of indentation as the 
immediately preceding line. If False, indentation has 
to be adjusted by spacing for any line that is not to 
start at the normal left-most position in the line- 
An example is shown in Figure 2-2. When the Ipft 
margin is controlled by AUTO-INDENT (True), the level 
of indentation is changed by using the (space) and 
(backspace) keys immediately following a ( return )» 

If FILLING is True, all insertions are forced within 
the right margin by automatically inserting a (return) 
between words whenever the right margin would have 
been exceeded. The Editor considers anything between 
two spaces or between a space and a hyphen to be a 
word. An example is shown in Figure 2-2. (See SET 
to set margins.) 

FILLING also causes adjustment of the right margin on 
the portion of the paragraph following an insertion- 
However, any line beginning with the Command character 
(see SET) is not touched, and that line is considered 
to terminate the paragraph. 



Line 1 Original indentation 

Line 2 (RET) causes indentation to the level of the line above 

Line 3 Indention was changed by (space) (space) 

Line A (RET) causes indentation to the level of the line above 

Line 5 Indentation was changed by (Backspace) 



DELETE 



Figure 2-2. Example of Auto-Indent 



DELETE mode is entered by typing "D" for Ddete. On 
entering DELETE mode, the following prompt line 
appears: 

)Delete: ( ) (floving commands) -((etx) to delete, 
, < esc > to abort> 



Page 9 



The curjior must be positioned at the first character 
to be deleted. When entering DELETE., the Editor 
remembers uihere the cursor is- That position ip 
called the anchor. As the- cursor is moved from the 
anchor position using the moving commands* text in its 
path will disappear. To accept the deletion* tig)e 
<etx>; to escape* type <e5c>. When <etx> is typt'd* the 
Editor saves everything thct loas deleted for COPY to 
use, Uhen <esc> is typed* nothing is deleted but th«' 
copy buffer contains what ujould have been deleted. An 
example is shoiun in Figure 2-3. 



This is the text before deleting: 



This sentence of the text is to remain the same. This 
sentence is to be modified by the delete command. 



Position the cursor over the "T" in t^e second occurrence of "to". Enter a 
"D" followed by typing 5 <space> keys and a <etx> key. This luill retult in 
the following text: 



This sentence of the text is to remain the same. This 
sentence is modified bu the delete command. 



figure 2-3. Example of Delete Command 

The repeat factor may be used to delete several lines 

at once by prefacing a (return) or any other of the 

moving commands uiith the desired repeat number while 
in DELETE mode. 



ZAP 



The ZAP command is executed by typing "Z" for Z(ap. 
This command deletes all texi; between the start of 
tBhat was previously found* replaced or inserted and 
the current position of the cursor. ZAP is designed 
to be used immediately a-Pter FIND, REPLACE or INSERI. 
If more than 80 characters are being zapped* the 
Editor will ask for verification. 

If a FIND or REPLAC£ is made «dth a repeat factor and 
then ZAP is called* only the last find or replace will 
be zapped. 



Paae 10 



Uhatever is deleted by ZAP is available for use ujitfi 
COPY. 

COPY 

COPY mode is entered by typing "C" for C<py. When 
entering the COPY mode* the following prompt line 
appears: 

>COPY: B(uffer F<ile <esc> 

Enter "B" to copy text in the copy buffer into the 
file at the location of the cursor u>hen the "C" wat- 
typed. On completion of the COPY* the cursor returnr- 
to a position immediately preceding the text that war. 
copied. The use of COPY does not change the contents 
of the copy buffer. 

Enter "F" to copy text from another file. ThF 
following prompt line aiill appear: 

>COPY: FROn WHAT FILEmARKER, MARKER]? 

Any file may be specified. Text is assumed. Ilarkers 
can be set so that a given portion of a file can be 
cqjied. On completion of the COPY (from file), the 
cursor returns to the beginning of the text just 
copied from the file. Use of COPY does not alter the 
contents of the file being copied. 

The copy buffer is affected by the following commands: 



DELETE ■*• On accepting a deletion, the buffer is 
loaded with the deletions on escape, the buffer is 
loaded with what would have been deleted, 

INSERT - On accepting an insertion, the buffer is 
loaded with the insertion; on escape, the buffer is 
empty. 

ZAP - When the ZAP command is used, the buffei^ is 
loaded with the deletion. 

When the deletion is greater than the buffer space 
available, after typing <etx>. the Editor will give 
the warning: 

There is no room to copy the deletion. Do you wish 
to delete anyway? <y/n) 

EXCHANGE 

EXCHANGE mode is entered by typing "X". On entering 

Page 11 



the EXCHANGli mode* the follDuiing prompt line appears: 

IIXCIIANGE- TEXT «bE;.> s char:- [(esc) escapes; <et.x> 
accepts 3 

EXCHANGE replaces one character in a file for each 
character of text entered- An example is shoiun in 
Figure 2-4. Backspacing ane character mill cause the 
original character in that position to reappear. 
Typing <e5c> leaves the EXCHANGE mode without making 
any of the changes indicated s:.nce entering the mode; 
while typing <etx> accc->pt5 the changes as part of the 
file. 

NOTE; EXCHANGE does not allou typing past the end of 
the line or typing in ej carriage return. 



This is the text before exchanging; 

PROGRAtI EXCHANGE; 
BEGIN 

URITELNCTHIS TEXT IS FINE'); 

URITELNCTHIS TEXT IS NOTFINE'); 
END. 



Position the cursor to the first "N" in "NOTFINE". Enter an "X" followed 
by typing "CHANGED" and a <etx> key. This uiill result in the folloujng text: 



PROGRAH EXCHANGE; 
BEGIN 

WRITELNCTHIS TEXT IS FINE'); 

URITELN<'THIS TEXT IS CHANGED'), 
END. 



Figure 2~A. Etample of Exchange 
FIN[) and REPLACE 

The folloa»ing rules apply to both FIND and REPLACE; 

1. The repeat factor is valid and roust be typed 
before typing "F" or "R '. The current repeat 
factor appears in brackets on the prompt line. 

2. The Editor provides^ ttuo string storage 
variables: 

Pagi? 12 



taTg thp target string (used by both) 
Bub the substitute (REPLACE only) 

Both delimiters of either string iuill be tht- 
same. The Editor considers any character that 
is not alphabetic or numeric to be a delimiters 
(space) is a particularly common delimiter- 

3. Text is scanned in the direction of the arrout on 

the prompt line. The target pattern can be 

found only if it appears in that section of the 
text. 

4-. In LITERAL mode/ the Editor u.iill look for any 
occurrences of the target string; in TOKEN mode» 
it looks for an isolated occurrence. Isolation 
means a string is surrounded by any combination 
of delimiters. To use the LITERAL mode* typu 
"L" after the prompt line and before the target 
linei to use TOKEN, type "T", The default 
value found in the Environment may be overridden 
by typing "L" or "T". TOKEN ignores spar er; 
within strings so that both "( ',' )" and ('» ') 
are considered to be the same string. 

5. To use the same string as used previously, typ«' 
"S". For example, typing "RS/(any-5tring>/" 
causes REPLACE to use the previous target 
string; tuhile typing "R/(any"5tring>/S" caut>eB 
the previous substitute string to be used. 

FIND mode is entered by typing "F". On entering FIND 
mode, one of the prompt lines belou) mill appear: 

>Findrn3: L(it (target) =) 
)Findrn3: T(ok (target) ~) 

FIND mode finds the repeat factor inl occurrence of 
the (target) string starting uiith the current position 
and moving in the direction shown by the arrou>^ 

REPLACE mode is entered by typing "R". On entering 
the REPLACE mode, one of the prompt lines belou* will 
appear: 

>Replacern3: L(it V(fy (tart) (sub) => 
>Replacern3: T(ok V(fy (targ) (sub) => 

REPLACE mode finds the repeat factor CnJ occurrence of 
the target string and replaces it adth the substitute 
string. 

The verify option (V(fy) allows examination of the 

Page 13 



target string (to the limit s<?t by the repeat factor) 

to decide if it is to be replaced. Whenever REPLACE 

has found the target patttjrn in the file and 

verification has been reque'.jted/ the follotuing prompt 
line appears: 

>Repl8ce: (esc) aborts* 'r' replaces. ■" ' doesn't 

Typing an "R" u>ill cause replijcement; typing a space 
will cause a continur-ftion of a search for the next 
occurrence if the limit of the repeat factor has not 
yet been reached. The reoea't; factor counts the nuroher 
of times an occurrence iti found, not the number of 
times "R" is entered. If <j slash </) is used as the 
repeat factor, every occurrence of the target string 
(Bill be replaced- 

If the Editor cannot find the target string, the error 
message appears: 

ERROR: Pattern not in the file. Please press 
< space bar) to zcr\tiT\ue. 

An example of REPLACE it shciuTi in Figure 2-5. 



(his is the text before replacing: 

PROGRAn REPLACE; 

BFCJW 

WRJTlLNCSOriE UORDS'); 
WKITI:LH<'I10RE WORDS' )i 
URITELNCEVEN MORE WORDS'); 

END. 



Position the cursor to the beginning of the text. Enter a 3R and the folloufing 
would be displayed: 



>REPLACEr33 L<it M(fy <targ) <5ub?) =) T/WORDB//STUFF/ 



fhis will result in the follotung text-; 



PRDCRAn REPLACE. 
BEGIN 

WRITELNCSOUE STUFF'); 
WRITELNCriORE STUFF'); 
URITELNCEMEN OORE STUFF'); 



Em, 



Figure 2-5. Example of Replace 

2,A.3 Formatting Commands 

The formattinp commands ADJUST and tIARGIN are used to control indentation and 

page format on a line-by-line basis (ADJUST) or by paragraph <i1ARGJ.N). 



ADuflfST 



MARGIN 



^JUST mode is entered by typing "A". On entering the 
ADJUST mode/ the following prompt line appears: 

>Adju5t: L(just R(ju5t C<enter < left* right/ up /down- 
arrows) {(etx) to leave> 

ADJUST mode adjusts indentation on a line-by-line 
basis. On any line/ the right-arrout and left-arroui 
commands move the luhole line one space to the right or 
left/ respectively/ each time the arrou» is typpd„ 
Type <etx> when indentation is adjusted. 

To adjust a sequence of lines/ adjust one/ then use 
the up-arrout and down-arrouj commands to adjust the 
line above or beloui/ respectively/ by the same 
amount. Repeat factors can be used before any of the 
arrows. 

"L" and "R" are used to left- and right- justify lines 
to margins set in the Environment. "C" mill center 
the line between the set margins. Typing an up- or 
down-arrow will justify or center the line above or 
below to the same specification. 



The MARGIN command is executed by typing "M". This 
command does not appear on the prompt line. MARGIN 
is Environment-dependent and cannot be executed except 
urfien FILLING is set to True and AUTO-INDENT is set to 
Fa Ise. 

Three parameters are used by margin: right-/ left- and 
paragraph- margin. MARGIN deals with only one 
paragraph at a time. It realigns the text to coflqDress 
it as much as possible without violating the three 
margins. To set the margin values/ see SET mode. An 
example is shown in Figure 2-6. 



Page 15 



This parapraph has been nARGINed with the parameters set: 

Li?ft margin 10 
Right margin 70 
Psraijraph margin 18 

The tlargin Command j.s executed by typing "PI" uihen 
the cursor is in the parsqrciph to be margined. The tlargin 
Command deals mith only one paragraph at a time and 
realigns the text to the spf?cification set in the 
environment. 

This paragraph has been riARGINed luith the parameter set: 

l.£ft margin 20 
Riohi; margin 60 
Paragraph margin 

rhe ilargin Command is executed by typ-.ng "f\" uthen the 

cursor is m the paragraph to be 
margined. The Ilargin Command deals 
with only one parii graph at a time and 
realigns the tisxt to the specification 
set m the environment. 



Figure 2-6. Example of Ilargin 

For purposes of formatting, a paragraph is defined as 
the lines of text occurring between tiuo blank lines. 
To MARGIN a paragraph> move the cursor anywhere in the 
paragraph and type "11", Jith an exceptionally long 
paragraph/ the routine nay take several seconds in 
execution before redisplaying the paragraph. 

Any given line of text can be protected from being 
HARGIHed if the the Command character appears as the 
first non-blank character on the line. The flARGIN 
treats that line as thotjgh :.t mere entirely blanks 
(See SET for setting the Command characters.) 

WARNING: Do not use HAREIN within a line that 
starts with the Command character. 

JL<1, -I lliscellaneous Commands 

SET mode is entered by typing "S"^ This command doeti 
not appear on the prompt line. On entering the SET 
mode? the following prompt line appears: 

>Set: IKarker E<nvironment <e5c> 

P.iae 16 



Markers are a convenience in a long filf?„ They are set 
by movin.9 the cursor to the position in the text to be 
fflarked> then typing "!1". The folloujinp prompt 'iine 
will appear: 

Name of marker? 

The name may be up to 8 characters follotued by a 
< return). Ilarker names are case-sensitive; upper and 
loiuer cases of the same letter are considered to be 
different letters. If the marker already existed? it 
luill be reset. 

Only ten markers are permitted in a file at any one 
time. On typing "SH"* if an overflow occurs? the 
following prompt mill appear: 

Marker ovflw. 

Which one to replace. 

0) namel 

1) name2 



9) namelO 

Choose a number through 9, type that number? and now 
that space will be available for setting the desired 
marker. 

Once markers are set? they can be Jumped to by using 
the M(arker option in the JUMP mode. 

If a copy or deletion is made between the beginning of 
the file and the position of the marker? the absolute 
position of the marker will be changed. 

Through SET mode? the Editor enables the user to set 
the Environment to meet the needs of the editing to be 
done. When "E" for E environment is typed? the 
following prompt appears: 

>E(nvironroent: •Coptions> <etx> or (sp) to leave 



A(uto indent 


True 


F<illing 


False 


I (eft margin 





R(ight margin 


79 



Paqe 17 



VERIFY 



SUIT 



P(ara margin 5 

C(o«imand rh '^ 

Koken def True 

nnnn bytes used, nnrin available 

Patterns; 

tarciet =- 'xyz'> subst = 'abc' 

The option values given in tie prompt are defaults for 
the Sorok 120. By typing the appropriate letter, any 
or all of the options may bs changed. Each option is 
described beloui- 

A(uto indent - Set to True (turned on) by typing 
"AT" and to False by "AF".. Affects only the IN^RT 
mode. 

F(illing - Set to True (turned on> by "FT" and to 
False by "FF". Affects the INSERT mode and allows 
the HARGIN command to function. 

hargins - Set by typing the appropriate letter ("L", 
"R" or "P") follouied by a positive integer of less 
than A digits and a (space). When Filling is True* 
the margins set here are the ones that affect INSERT 
and HARGIN and the center and Justify commands in 
ADJUST. 

C(omffland ch - Set by typing "C" followed by any 
character. Affects the MARGIN command and the 
Filling option of the INSERT mode. 

T(oken def - Set to Trut> by "TT" and to False by 
"TF". If True, Token is the default; if False, 
Literal is the default. Affects FIND and REPLACE. 



The VERIFY command is executed in response to typing 
'V'\ Tfie status of the Editor is verified by 
displaying the updated screen. The Editor attempts 
to adjust the mindoui so the the cursor is at the 
center of the screen. 



QUIT mode is entered by typing "Q". On entering the 
QUIT mode, the following pronpt appears: 

>Ouit: 

U(pdate the work file ard leave 

E(xit without updating 

R(eturn to the editor udthout updating 



Pr- 



.9«? 18 



U<rite to a file name and return 

One of the four options must be selected by typing the 
appropriate letter„ The options are described belou;: 

IXpdate - The Editor writes the file Just modified 
into the a<orkfile and stores it as SYSTEH.WRK.TEXT. 
It is available for either the Compile or Run 
options or for the Save option in the Filer. Ihe 
Filer regards it as the text file„ 

E(xit - The Editor leaves without making any changes 
in SYSTEil.WRK. TEXT. Any modifications made since 
entering the Editor are NOT recorded in the 
permanent i»ork file. 

R(eturn - The Editor returns tuithout updating. The 
cursor is returned to the exact place in the file 
it occupied when "Q" was typed. Usual ly> this 
command is used after typing "Q" unintentionally. 

U(rite - With this option» a further prompt appears: 

>Quit: 

Name of output file (<cr> to return) — > 

The modified file may be written to any file name. 
If it is an existing file, the modified file will 
replace it. The command can be aborted by typing 
< return) instead of a file name; return will be to 
the Editor. After the file has been written to 
disk J the prompt will be: 

>Quit: 

Writing ....... 

Your file is nnnn bytes long. 

Do you want to E<xit from or R<eturn to the Editor? 

Typing "E" exits from the Editor and returns to the 
Outer Command level. Typing "R" returns the cursor 
to the same position in the file as when the "Q" was 
typed. 



2„4.5 L2 Editor 

The L2 Editor handles files larger than can fit into the main memory buffer 
at one time (i.e., what can fit into the space available on the disk)» 
Also, it automatically makes a backup copy of the file being edited- There 
are very few differences between the L2 Editor and the Screen -Oriented 
Editor previously defined in this section. The differences are described 
below. 

If, on entering the Editor by typing "E", there is not room enough on the 

Page 19 



di.s>!» the following error messaqe will be displayed: 

ERKOR: Not enough room for bacl<up! 

The disk must be K(runched bi) the Filer to combine unused blocks at the 
end. or a file must be removed.- or another disk must be used. fht-nj uthen 
"E" ic typed> the folloujing prompt lines appear: 

Copying to filename. back. 

>Edit (same as for standard Editor) 

Reading ....,.,. 

In 'ejection 2-3. the description of entering a workfile and getting a program 
applies also to the L2 Editor. 

Uhen all changes and additions have been made> the Editor is exited as usual.- 
by typing "S"^ except that the U<rite option is not available. The other 
three options have added features: 

LKpdate - supplies additional information to indirote 
the file name and length. Belom is an example of the 
extra information given uihen a neuj file is created: 

Writing. « 

The morkfile, «:F1.TEXT. is- 72 blocks long- 

The backup file is X: PL. BACK. 

The newly edited file is ., TEXT; and the original file 
ttdth no modifications is .BACK. 

t<x:it " no .BACK file is made and the existing one is 
removed. 

R<eturn - no changes- 

A FetB of the Editor commands are handled differently. They are: 

JUilP - The prompt line is the same^ however the "B" 
and "E" refer to the beginning and end of the buffer > 
not the file. 

FIND - The Editor displays "Finding ..." and gives 
t))e pattern. If the pattern :.s not in the buffer* it 
displays: 

End of buffer encountered. Get more from disk? 
(Y./N) 

On typing "Y'S the Editor mill move another section of 
the file into the buffer and continue searching. FIHD 
is still directional. 

BET - tiarkers are c-et bj typing "Sil".- as in the 
standard Editor. However, up to 20 markers are 

Pjge 20 



permitted, rather than 10. The environment is set by 
typing "SE". The prompt displayed pives additions i 
information, as follows: 

>EnvironmBnt: options <etx> or <sp> to lave 
A(uto Indent 
F-<illin5 
L<eft margin 
R<i9ht fflar(jin 
P(ar3 margin 
C(offlfliand ch 
T(oken def 

nnnn bytes used» nnnn available^ 

There are n papes in the left stack, and n pages in 
the ripht stack. You have n pages of room, and at 
most n papes luorth in the buffer. 

rtarkers; <P1 P2 >P3 

(no arrou) indicates the marker is in the 

current buffer) 

Created mm dd yy; Last updated mm dd yy (Revision 
n). 

The L2 Editor contains tuio new commands, BANISH and HEXT. They are described 
below. 



BANISH 



HEXI 



BANISH is entered by typing "B". The foliowinp prompt 
line will appear; 

>Bani5h: To the L(eft or R(ipht <esc> 

BANISH moves characters from the buffer into the stack 
to provide more room in the buffer to avoid overflow 
when doinp a larpe insertion or copy. The left and 
ripht stacks are ahead of and behind the cursor, 
respectively. The screen is the boundary for the 
operation. 



NEXT is entered by typinp "N" to move beyond the 
bounds of the buffer. The following prompt line 
appears: 

Next: F(orwards, B(ackwards in the file: S(tart, 
E(nd of the file, (esc) 

When usinp "F" or "B", an implicit banish occurs osinp 
the cursor as the point of reference™ With "F", 

Page 21 



everything above the screer\ is banished to the left 
stack, (lore characters arn added to the bottom of the 
screen to extend the buffer in the fomiard direction. 
With "B", the characters belou the cursor are banished 
to the right stack and the lower part of the screen 
becomes blank. More characters are added above the 
screen- Thus* the symbolic file can he diagrammed as 
shomn be lout. 



LEFT STACK 

BACKWARD 

START 



BUFFIZR 



RIGHT STACK 

FORWARD 

END 



2.5 YET ANOTHER LINE-ORIENTED EDITOR <YALOE) 

The YALOE text editor is designed For use in systems that have a teleprinter 
or teletypewriter as the system opi?ra1;or's console rather than a video display 
terminal. 

The Editor assumes the existence of a iuorkfile> but is not dependent on it. 
The uiorkfile can be created after en1;ering YALOE. If a work file already 
exists^ the Editor mill print: 

Work file STUFF read in. 

Xf the Editor is called and the uiorkfile is emptyi the Editor will give the 

No ujorkfile read in. 

The Editor operates in either Command flode or Text flode. The Editor is in 
Command Hode when entered. In Command Mode, all keyboard input is assumed to 
be commands. Each command may be terminated by <esc>. The commands may be 
strung together. No commands in a string (or singly) will be executed until 
the final command in the string is followed by <e5c> (esc>. Spaces* carriage 
returns and tabs within a command spring are ignored unless they appear in a 
text string. When the execution of a command string is complete* the Editor 
prompts for the next command with an .jsterisk («). In contrast to other levels 
of the Pascal Operating System, a prompt line of available commands is not 
given. 



If an error is encountered during command execution* 
terminated at that point without completing execution. 



the command will be 



The Text tlode is entered whenever a command is typed that must be followed 
by text. Then all succeeding characters are considered to be text until the 
next <esc>. The commands that require text are F(ind* G<et* Knsert* IKacro 
define* R<ead file* W(rite to file, aid eX(change. 



Page 22 



MOTE: When typed. <e5c> echoes a dollar sign ($). The <eEr> terminates 
each text string and causes the Editor to re-enter the Cominand tlode. A 
double <esc> terminates the command string and causes the Editor to start 
execution. 

The a>orkfile is stored in the text buffer. This area is allocated dynamically 
by the ? command (section 2.5.5). The Editor can luork only on files that 
fit completely within the text buffer. 

The cursor is the position in the file luhere the next command will be executed. 
Host edit commands function in relation to the cursor. 

Some of the YALOE commands described here require a command argument to 
precede the command letter. Usually* the argument specifies the number of 
times the command should be performed or the particular portion of text to 
be affected by the command. Uith some commandsi the specifications are 
implicit and no argument is needed. The command arguments used by YALOt 
are: 

xt Any integer, signed or unsigned. Unsigned integers 

are assumed to be positive. In a command that accepts 
an argument, the absence of one implies 1 (only one 
execution) or minus 1 if only the minus sign is 
present. 

m A number in the range of through 9. 

o The beginning of the current line. 

/ The same as 32700, A "-V" is -32700. It is used For 
a large repeat factor, 

=■ Represents -n where n equals the length of the last 
text argument used. Applies only to the J. D. and C 
commands. 

2.5,1 Special Key Commands 

Various keys on the keyboard have special functions, some of which are 
unique to YALOE. These commands are described below. Those control keys 
that do not appear below are ignored and discarded by YALOE. 



( e&c > 



The escape key is echoed as a dollar sign (*) on the 
operator's console. A single <esc> terminates a text 
string. A double (esc) executes a command string. 



RUBCIIT 
< linedel) 



On hard-copy terminals, line delete is echoed as 
"(ZAP" and a carriage return. On others, it clears 

Page 23 



the current line on the screen. In both cases* the 
contents of that line are discarded by the Editor. 



CTKL H 
<ch3rdel> 



CTkl X 



CTRL 



On hard-copy terminals, character delete is echoed as 
a percent si.qn </i) folloujed by the character deleted. 
Deletions are done right to left, luith each character 
deleted erased by the X, up t3 the beginning of the 
command string. CTRL h' may be used in both Command 
and Text Modes. 



CTRL X causes the Editor to ignore the entire command 
string, and respond mith a carriage return and an 
asterisk (») to pronH^t for another command. The 
command string being ignored may be on several lines. 
All lines back to the previous k prompt are ignored- 
(A character delete is confined to one line.) 



CTRL causes the Editor to stuitch to the optional 
character set (bit 7 turned on). This applies only to 
the TERAK 8510A. 

NOTE: If strange characters start appearing on the 
terminal CRTL may have been hit accidentally. 
This is corrected by ttiping CRTL again. 



CTRL F 
fiut>h 



CTRL F causes the Editor to discard all output to the 
terminal until the next CTRL F is typed. 



CTRL S 
t>tof> 



CTRL S causes the Editor to hold all output to tlie 
terminal until the next CTRL S is typed. 



2,5»2 Input/Output Commands 

(he commands that control 1/0 are de<»cribed belou*. 

i 1ST 

The LIST command is specified by typing "L" for 
L(i5t. It causes the Editor to print a specified 
number of lines on the terminal without moving the 
cursor. Variations of this command are illustrated in 

Page 2^ 



VERIFY 



wr:cte 



READ 



the examples belou). 

K~3L$$ Prints all characters starting at the third 
preceding line and ending at the cursor. 

«5L** Prints ail characters beginning at the cursor 
and terminating at the fifth carriage return 
(line), 

KOL$$ Prints from the beginning of the current line 
up to the cursor. 



The VERIFY command is specified by typing "V" for 
V(erify„ It causes the Editor to print the current 
text line on the terminal. The position of the 
cursor within the line has no effect on the command 
and the cursor is not moved. No arguments are used. 
VERIFY is equivalent in effect to a "«0L**" liBt 
command. 



The WRITE command is specified by typing "W" for 
U(rite followed by the file title, in the following 
format: 

«U<file title >$ 

The file title is any legal file title described in 
Section 3.2, except that the file type is not given. 
The Editor u»ill automatically append ".TEXT" as a 
suffix unless the title ends ufith ".", "3" or ".TEXT". 
If the title ends in ".". the period mill be stripped 
from it. 

The WRITE command uiill unrite the entire text buffer to 
a file having the given file title. It will not move 
the cursor or alter the contents of the text buffer. 
If the volume specified by the file title has 
insufficient room for the text buffer, the follotuing 
error message mill be given: 

OUTPUT ERROR. HELP! 

The text buffer can be written to another volume. 



The READ command is specified by typing "R" for R(ead 
followed by the file title, in the following format: 

KR<file title >$ 

Page 25 



Qun 



The Editor uiill attempt tc locate the file title as 
given. If no file is found having that title* a 
".TEXT" is appended and a nea search is made- 

The READ command inserts the specified file into the 
text buffer starting at the location of the cursor. 
If the file read in does not fit, the entire text 
buffer mill be undefined in content. This is an 
unrecoverable error. 



The QUIT command is specified by typing "Q" foi- 
Q(uit- It has several forms; as folloas: 

QU Quit and update by mriting out a nets SYSTEM. WRK. TEXT 
«E Quit and escape Editor; do not alter the ujork file. 
QR Do not quit; return to the Editor 

If "Q" is typed alone, a prompt mill be sent to the 
terminal giving the above cho-^ces. An option must be 
entered (U* E or R). 

The "QU" command is a special case of the WRITE 
command. If QU does not uork, "W" can be used to 
write out SYSTEH.URK.TEXT foilottted by "QE" to exit 
from the Editor. "QR" is used to return to the 
Editor after a "Q" has been typed accidentally. 



The ERASE command is specified by typing "E" for 
E<ra5e. It functions onlj with video display 
terminals and causes the Editor to erase the screen. 



The command is specified by typing "0". It 
functions only with video display terminals and causes 
the Editor to display the text around the cursor eech 
time the cursor is moved. The argument for the 
command specifies the numaer of lines to bt» 
displayed. This option is in a disabled state when 
the Editor is entered. If needed, it must be enabled 
by using the command. A second disables the 
option. The location of the cursor is denoted by a 
split in the line of text. 

2.b.3 Moving Commands 

The moving commands relocate the cursor to a neui position. Ihese commands 
are important because most other editing commands are dependent on cursor 
positioning. The moving commands are described below. 

Page 26 



ERASE 



The direction of cursor movement is specified in the commands by the sipn 
of the argument. A positive <+n) argument gives the number of characters 
or lines to move in a forward direction; and a negative argument <-n), in 
a backward direction. 

Carriage return characters are treated the same as any other character in 
text except that the <cr> denotes the end of a line of text. 

Examples of the moving commands are given in Figure 2-7. In the examples^ 
the cursor position is indicated by an up arroui <''^) although the cursor does 
not actually appear on the teleprinter or teletypewriter. 



JUMP 



The JLHtP command is specified by typing "J" for 
J<ump. JUilP moves the cursor a specified number of 
characters in the text buffer. Movement may be either 
forward or backward and is not restricted to just the 
current line. 



ADVANCE 



The ADVANCE command is specified by typing "A" For 
A(dvance. ADVANCE moves the cursor a specified number 
of lines. The cursor is then positioned at the 
beginning of the line to which it moved. An argument 
of zero moves the cursor to the beginning of the 
current line. Movement may be either forward or 
backward. 



\\&T<a are the original lines and the cursor position. 

THE TIME HAS COME<cr> 

THE WALRUS SAID'^<cr> 

TO TALK OF MANY THINGS<cr> 

Example 1. k8,J$* moves the cursor forward 8 characters to the next line 
between the K and the space. 

TO TALK'^ OF MANY THINGS<cr> 

Example 2. K"2A*$ moves the cursor to the beginning of the second preceding 
line. 

-^THE TIME HAS COrE<cr> 

Example 3. kBGTUINE$=J$$ moves the cursor to the beginning of the text 
buffer, then starts searching for the string "TUINE". When the string is 
found, the cursor will be positioned immediately before it. 

Page 27 



Figure 2-7. EXAnPLES OF THE MOVING COHHAHDS 
BEGINNING 

The BEGINNING coffimand is specified by typing a "B" for 
B(egiiining. BEGINNING moves the cursor to the 
beginning of the text buffer. 

GET and FIND 



The search commands GET and FIND are synonymous. GET 
is specified by typing "G" and FIND by typing "F". 
With either command, the current text buffer is 
searched starting from the location of the cursor for 
the nth occurrence of a specified text string. Upon 
completion of a successful search, the cursor is 
positioned immediately following the nth occurrence if 
n is positive and immediately before if n is 
negative. If the search is unsuccessful, the Editor 
generates an error message, and the cursor is 
positioned at the end of the buffer if n is positive 
and at the beginning if n is negative. 

2.5. A Text Changing Commands 

The text-changing commands add to, remove or change the text. They are 
described below. Examples are given in Figure 2-8- 

INSERT 

The INSERT command is specified by typing "I" for 
Knsert. INSERT causes the Editor to enter Text Mode 
to add characters immediately following the cursor 
until an <C5C> is tifl>ed. After insertion is 
completed, the cursor is positioned immediately 
foUoffling the last character inserted. 

Occasionally with a large insertion, the temporary 
buffer will become full. Eefore this happens, the 
following message is printed on the operator's 
console. 

Please finish- 
Typing <esc> <e5c> will terminate the insertion at 
that point so that the temporary buffer can be emptied 
into the text buffer. Insertion can then be continued 
by again typing "I" to re-enter the Text Mode. 
Forgetting to ti^e the "I" w:.ll cause the characters 
that are next entered as insertions to be interpreted 
as commands. 

Page 28 



K-'ID** Deletes the four characters immediately preceding the 
cursor/ even if they are on the previous line. 

KBfGTUINE *=:D$$ Hovbs the cursor to the beginning of the text buffer/ 
searches for the string "TWINE'S and deletes it. 



K/K$* 



KOCAAA$$ 



Deletes all lines in the text buffer from the line in which 
the cursor is positioned to the end of the buffer. 

Replaces the characters from the beginning of the line to 
the cursor with "AAA" (same as «OXAAA*$). 



«8GA$=CBt* Searches for the first occurrence of "A" and replaces it 
with "8". 



H--3XhEW$* 



Exchanges all characters beginning with the first character 
on the third line back and ending at the cursor with the 
string "NEW". 



DELETE 



KILL 



CHANGE 



Figure 2-8- EXAMPLES OF TEXT-CHANGING COIHIANDS 



The DELETE command is specified by typing "D" for 
D<elete. DELETE removes a specified number of 
characters from the text buffer* starting with the 
position of the cursor. On completion of the 
deletion* the cursor is positioned immediately 
following the deleted text. 



The KILL command is specified by typing "K" for 
K<iH. KILL deletes a specified number of lines from 
the text buffer starting at the position of the 
cursor. On completion, the cursor is positioned at 
the beginning of the line following the deleted text. 



The CHANGE command is specified by typing "C" for 
C<hange. CHANGE replaces n characters* starting at 
the position of the cursor* with the given text 
string. On completion, the cursor is positioned 
immediately following the changed text. 



EXCHANGE 



The EXCHANGE command is specified by typing "X" for 

Page 29 



eXtchange. EXCHANGE exchanges n lines^ starting ujith 
the line on mhich the cursor is located^ luith the 
indicated text string. The cjrsor remains at the end 
of the changed text on coff;pletion of the command. 



2.5.5 



iliscellaneous Commands 



smh 



UHiiAVfc 



HACRO 



The SAVE command is specified by typing "S" for 
S(ave. SAVE copies the specified number of lines into 
the save buffer* starting at the cursor. On 
completion, the cursor position is unchanged and the 
contents of the text buffer are unaltered. Each time 
save is executed, the previous contents of the save 
buffer, if any, are destroyed. If executing a SAVE 
ujill cause the text buffer to over- floui, the Editor 
will generate a message and not perform SAVE. 



The UNSAVE command is specified by typing "U" for 
LKnsave. UNSAVE inserts the entire contents of the 
save buffer into the text buffer at the cursor. On 
completion, the cursor is still positioned before the 
inserted text. If the text buffer does not have 
enough room for the contents of the save buffer, the 
Editor will generate a siessage to this effect and 
and not execute the unsave. 

The save buffer may be removed by typing "OU". 



A macro is a single command that performs a string of 
standard, but related commands. Any group of 
frequently used commands can be grouped into a macro 
to eliminate the need for having to write the whole 
setof instructions whenever they are needed. The user 
may create macros by using the fUacro command. The 
ilACRO command is specified by typing "H" for fKacro in 
the following format: 



mt1%command stringZ 



where m is an integer 
IlACRO is used to define a 
default number is 1. 
into the macro buffer m. 
(% in the above case) 



in the range of through 9. 
maximum of 10 macros. The 
The command string is stored 
The command string delimiter 
is always the first character 
following the "11". The delimiter may be any character 
that does not appear in the macro command string 
itself. The second occurrence of the delimiter 
terminates the macro. 



9 age 30 



All characters except the delimiter are legal macro 

command strinp characters* including a single <e5C>« 

All YALOE commands are legal. An example is given in 
Figure 2-9. 

If an error occurs u>hen defining a macro* the 
following error message is generated: 

Error in macro definition. 

The macro uiill have to be redefined. 

N (Execute Macro) 

The N command is specified "N" in the following 
format: 

nNm* 

to execute a specified macro command string. The n is 
simply any command argument (E.G., a repeat factor) 
and m is the macro number to be executed. If m is 
omittedi 1 is assumed. Because m is technically a 
command text string* the N command must be terminated 
by <e5C> (echoed as $). 

Attempts to execute undefined macros result in the 
generation of the following error message: 

Unhappy macnum. 

Errors encountered during macro execution generate: 

Error in macro. 

? (List) 

The ? command is specified by typing "?" to print a 
list of all commands and the sizes of the text buffer* 
save buffer* and the memory still available for 
expansion. 



K4i1%FPREFACE*~CEND PREFACE*V*r.** 

This example defines macro number A. When macro 4 is 
executed* the Editor will look for the string "PREFACE"* 
change it to "END PREFACE"* and then display the change 
to verify it. 



Page 31 



Figure 2-9. EX^HPLE OF I1ACR0 COHHAND 



2.6 FILE HANDLER 



The File Handler handles* identifi.es* structures and restructures the files 
described in Section 3.2. The file basic to the Pascal operating system is 
the luork file which is a temporarij copy of the file being modified or created. 
The work file name on the diskette is kSYSTEM.URK.TEXT lohen the text of a file 
is being changed. When a code version is first created* the name is 
«SYSTEi1.WRK.C0DE. 

Hany File Handler commands require a file specification. The diagram in 
Figure 2-10 illustrates the syntax of file specification. Whenever a 
specification is requested, as manii files as desired may be specified* 
separating the specifications Por each file i»ith commas and terminating the 
list luith a carriage return. Commancs operating on single file names mill 
keep reading the names from the list and operating on them until there are 
no more names. Commands operating or tu»o file names at once (e.g.. CHANGE 
and TRANSFER) will take file names in pairs until one or none remain. In 
this case* if only one name remains* the File Handler mill prompt for the 
second name. If an error is detf'cted in the list* the entire list luill be 
f lu&hed. 

The rules for legal file and voluine rames are given in Section 3.1* Files. 

The File Handler performs the reijuested action on all files meeting the 
specifications. The luild card chciracters "=" and "?" are used to specify 
subsets of the directory. For example* a file specification containing the 
subset-specifying string "PUB=TEXT" notifies the File Handler to perform 
the requested action on all files uihose names begin u»ith the string "PUB" and 
end with the string "TEXT". 

If a "?" is used instead* the File Handler requests verification before 
performing the requested action on efich file meeting the specified criteria. 

Either or both strings may be empty. For example* a subset specification 
"=<string>" or "(string>=" or ev{?n "=" is valid. In the last case* luhere 
both strings are empty* the File Handler acts on every file in the volume 
directory. The same applies to "?" used alone* except here the File Handler 
verifies first. 



P.jge 32 



file speoifiaat'ion 



volume ID 



< 



volume ID 



j pf string V 



u©-J 



1/ string \- 



U-J — p*\ integer J A^y-y 



■*G> 



■0 



-9 



-®< 



unitnumber 



( votname y. 



Fipure 2-10 . FILE SPECIFICATION 

The File Handler is entered by tijpiny "F" uihen at the Outer Level of commands- 
The following prompt line u>ill appear; 

Filer. G(et> S<ave» W(hat. N(et9» L(dir/ R(effl» C<hng/ T(rans^ D<ate, Q<uit 

Additional File Handler commands are displayed in response to typing "7". 
The prompt line is: 

Filer: B(ad-blk5/ E(xt-dir/ K(rnch^ IKake^ P(refix> V<ol5^ X(amine» Z(ero 

The operator invokes the execution of individual commands by typing the 
character on the operator's console, ilany of the commands give additional 
prompt lines to get all of the information necessary for execution. Answering 
a Yes/No question on a prompt line u»ith any character other than "Y" 
constitutes a Ho answer. Tijping an <esc> mill return control to the Outer 
Level of commands. 



2a 6><- X 

GET 



'F" Prompt Line Commands 



The GET command is specified by typing "C" for G(et„ 
GET loads the designated file into the u»orkfile. When 
"G" is typed^ the File Handler responds with the 
following prompt line: 

Get what file? 

The entire file specification is not necessary. If 
the volume ID is not giveni the default disk is 
assumed. Wildcards are not allowed? and the si^e 
specification is ignored. The suffixes ".TEXT" and 
",CODE" are not required if both are present and both 
dve loaded. If only one is present* the File Handler 
will load that one regardless of whether code or text 
has been specified. 



Page 33 



JAVf- 



WHAT 



NEU 



When the File Handler has completed loading. it 
responds with one of the fol lowing messages: 

Text and Code file loaded. 
Code file loaded. 
Text file loaded. 



The SAVE command is specified by typing "S" for 
S(ave. SAVE saves the luork file under the file name 
specified by the user in response to the prompt: 

Save as what filt? 

The entire file specification is not necessary. If 
the volijme ID is not givi3n> the default dif.k i?- 
assumed. Uild cards are not allowed* and the size 
option is ignored. The File Handler automatically 
appends ".TEXT" or ".CODE"* as appropriate, so these 
suffixes must HOT be entered. 

Any illegal characters in the file name will be 
ignored except a colon (:). If the file 
specification includes the volume ID* the File Handler 
assumes that the work file is to be saved on another 
file. In that case* a colon is assumed to separate the 
file name from the volume nam?. 

For example* if the operator enters "BLACK: BART" in 
response to the prompt "Save as what file?"* the File 
Handler will generate the prospt line: 

Would you like BART. TEXT written to BLACK: ? 

A "Y" answer to this prompt will cause the File 
Handler to attempt a transfer of the work file to the 
specified volume and file (see TRANSFER). 



The WHAT command is specified by typing "W" for 
W<hat. WHAT identifies the name and status (saved or 
not saved) of the work file. 



The NEW command is specified by typing "N" for N(pw. 
NEW clears the work file. No file specifications are 
permitted. If a work file is already present* the 
File Handler responds with: 

Throw away current work file? 



LIST 



REilUVE 



A response of "Y" will clear the work file? while "N" 

returns the user to the outer level oP the File 

Handler. If a backup iBork file exists* the follouiinp 
prompt line is (generated: 

Remove < work file name). BACK? 



The LIST command is specified by typing "L" for 
L<dir. LIST lists a disk directory* or some subset 
thereof* to the volume and file specified. The 
default is CONSOLE:. The File Handler responds to "L" 
aiith the following prompt line: 

Dir listing of what vol? 

The user may list any subset of the directory using 
the wildcard option* and may also write the directory 
or a subset to a volume or file name other than 
CONSOLE. File specification roust be in terms of 
source and destination. 

Source file specification consists of a mandatory 
volume ID and optional subset-specifying strings* 
which may be empty. If the latter are used* one of 
the wildcard characters is required. A string (i.e.* 
the full file name including ".TEXT") may not be used 
as part of the source file specification unless a 
wildcard character is used. Source file information 
is separated from destination file information by a 
comma. 

Destination file specification includes a volume ID 
and* if the volume is block-structured* a file name. 
File size will be ignored. 

This command is most frequently used to list an entire 
directory. The bottom line of the listing gives the 
number of files listed out of the number on the 
volume* and the number of blocks used* and the number 
of blocks unused. 



The REMOVE command is specified by typing "R" for 
R<em, REMOVE removes file entries from the 
directory. When "H" is typed* the File Handler 
responds with the following prompt line: 

Remove what file? 

One specification is required for each file to be 

Page 35 



CHANGE 



removed. Wildcards are lepal. Size informatioi) is 
ignored. 

NOTE: SYSTEn.URK.TEXT and SYSTEII-URK.CODE should be 
reiBoved only by the NEW command. 

The use of just the initial letter of several file 
names mill remove all files beginning luith that 
letter. Typing the file specification "=" will remove 
every file in the directory unless a subset (s) is also 
specified. Houjever^ before finalizing any wildcard 
removes* the File Handler prompts luith: 

Update directory? 

A "Y" causes all specified files to be removed. "N" 
returns the user to the oijter level of the File 
Handler without removing anything. 



The CHANGE command is specified by typing "C" for 
C(hange. CHANGE changes the file or volume name. 
When "C" is typed, the File Handler responds with the 
following prompt: 

Change what file'? 

This command requires two Pile specifications: thr 
file to be changed, and the new name. The first is 
separated from the second bj either a <ret> or a 
comma. Any volume ID information in the second file 
specification is ignored because the old and new files 
are on the same volume. Size is also ignored. 

Wildcard specifications are legal. If a wildcard 
character is used in the first file specification, 
then it must be used in the second. The subset- 
specifying strings in the first are replaced by the 
analogous strings <replacement strings) in the second. 

The File Handler will not m.jke the name change if the 
new name exceeds 15 characters. 

On completion of the change, the File Handler reports 
what changes were made. For i?xample. in response to: 

HIGH: ST=TEXT, LOW=END 

The File Handler will respond with: 

HIGH: START. TEXT changed to LOWRT.END 
HIGH: STOPS, TEXT changes to I.OWPS.END 



Pa 56 36 



TRANSFER 



The TRANSFER command is specified by typing "T" for 
T<ran5fer. TRANSFER copies the specified file to the 
piven destination., leaving the source file intact. When 
"T" is typed* the File Handler responds with the prompt 
line: 

Transfer <uhat file? 

File specifications for both the source and 
destination files are required* separated by a <ret> 
or a comma. Wildcards are permitted* and size 
information is recognized for the destination file. 
The source specification is given in response to the 
above prompt line. If the destination is not also 
given* the File Handler then responds with the prompt 
line: 

To where? 

On a one-drive machine* the source disk must NOT be 
removed until prompted to insert the destination disk* 
as follows: 

Put in < destination volume) 
Type < space) to continue 

After the transfer has taken place* the File Handler 
notifies the user as follows: 

<source vol:file) transferred to (destination vol: file) 

On a one-drive machine the user will have to alternate 
inserting the source and destination disks until the 
transfer is complete. 

A file can be transferred to another volume without 
changing name and without specifying the destination 
file name by other than a dollar sign (f) to signify 
that the name is the same. The destination volume 
still must be specified. 

WARNING: The file name for the destination cannot be 
omitted completely. Otherwise* the directory for the 
complete volume may be wiped out. If the file name is 
omitted and no "$" is used* the File Handler will 
query: 

Possibly destroy directory of < destination vol) ? 

A "Y" answer will wipe out the directory of the whole 
destination volume. 



Page 37 



Piles may be transferred to volumes that are not block 
structured ie.g,, C0N3a£ or I'RINTER) by specifying 
the appropriate volume ID. A i-ile name then is 
ignored. The user should maki? certain that the 
destination volume is on-line. 

Transfer can also be made fro<i a non-block-structured 
device if it is an input device. In this case* any 
file name in the source file !>pecification is 
unnecessary and will be ignor(?di if present. 

If the source file specification includes a wildcard 
character > and the destination is to a block- 
structured device, then the destination file 
specification must also contai.n a wildcard character. 
The subset- specifying strings for the source will be 
replaced by analogous strings (replacement strings) in 
the destination. Any of the subset-specifying or 
replacement strings may be empty. The file 
specification of "=" speciFien every file on the 
volume. 

WARNING: The output buffer may overflow if the 
transfer of the uihole disk is handled in this u»ay. A 
better way of handling volume-to-volume transfers is 
by specifying only the source and destination volume 
IDs. Transferring from one block-structured volume to 
another causes the destination volume to be "wiped 
out" so that it becomes an exact copy of the source. 
A prompt is generated to verify if that is what 
is wanted: 

Possibly destroy directory of < destination vol) ? 

With a "Y" answer, the directory will be destroyed. A 
"N" answer will return control to the outer level of 
the File Handler. Often the "■"" answer is desirable to 
create a copy of the source d:kSk for backup purposes. 
In this case, the name of the destination volume 
probably should be changed to indicate that it is a 
backup of the source volume (.nee CHANGE for name 
change). The source volume w:. 11 not be destroyed. 

Using "=" as the destination file name specification 
has the effect of replacing the subset-specifying 
strings in the source specification with nothing. The 
"?" may be used in place of the "=", but then the user 
will be asked for a verificat:i.on before the transfer 
is performed. 

WARNING: Wildcard characters :in specifications should 
not be used on same-disk tranijfers. The results are 
unpredictable. 



Paije 38 



QUIT 



A file can be transferred from a volume to the same 
volume by 5pecifyiTi(.g the same volume name for both 
source and destination. This is useful to relocate a 
file on the disk. Specifying the number of blocks 
desired will cause the File Handler to copy the file 
into the first available area of at least that size. 
If no size specification is given> the file is 
written into the largest unused area. 

On a same-disk transfer * if the same file name is 
specified for both the source and destination* the 
File Handler reunrites the file to the size-specified 
area and removes the older copy. 



The SUIT command is specified by typing "Q" for 
Q(uit. QUIT returns the user to the Outer Level of 
commands. No file specification is allowed. 



2.6.2 "7" prompt Line Commands 

BAD BLOCKS 

The BAD BLOCKS command is specified by typing "B" for 
B(ad blocks. BAD BLOCKS scans the disk and detects bad 
blocks. When "B" is typed/ the File Handler responds 
with the folloujing prompt line: 

Bad blocks scan of what volume? 

The user must specify the volume ID. The File Handler 
checks each block on the given volume for errors and 
lists the number of each bad block. Bad blocks can 
often be fixed or marked (see EXAHINE). 

EXTENDED LIST 

The EXTENDED LIST command is specified by typing "E" 
for E<xt-dir. EXTENDED LIST lists the directory in 
more detail than the LIST command. All prompts and 
wildcard options are the same as for the LIST command. 
All files and unused areas are listed along with the 
corresponding block length/ last modification date* 
starting block address* number of bytes in the last 
block in the file* and the file kind. The summation 
line at t-he end of the list is the same as that for 
LIST. 



KRW^ICH 



The KRIWCH command is specified by typing "K" for 
K<runch. KRIWCH moves the files on the specified 

Page 39 



MAKE 



PRFFIX 



volume 5o that unused blockfj are prouped at the end, 
When "K" is typed* the File Handler responds u»ith the 
folloujing prompt line: 

Crunch mhat vol? 

When the user responds with thC' volume ID* the File 
Handler .generates: 

Are you sure you luant to crurch < volume ID> ? 

A "Y" ansiuer initiates the crunch. A "N" returns the 
user to the outer level of the File Handler. 

The specified volume must te on-line. A bad block 
scan of the volume before crunching is strongly 
recommended in order to .woid luriting files over had 
areas of the disk. If bad blocks are found, they must 
be either fixed or marked before crunching (see 
EXAMIME). 

As each file is moved, its. name is reported on the 
console. If SYSTEH. PASCAL is moved, the system mui,t 
be reinitialized by bootstripping. Until this task 
has been completed, do not touch the disk, reset- 
switch or disk -drive door. 



The HAKE command is specified by typing "t1" for 
FKake. MAKE creates a directory entry with the 
specified file name. Uhen "t1" is typed, the File 
Handler responds mith the follciiuing prompt line: 

Hake what file? 

The file specification must be entered. In this case, 
the size is extremely useful because, if it is 
omitted, the File Handler creai;es the file by using 
the largest unused area of disk. The file size is 
given by follouting the volume ID and file name u>ith 
the desired number of blocks enclosed in brackets. 
TuM3 special mays of specifying size are: 

roil The same as omitting siie- The file is 
created in the large^st unused area. 

r»] The file is created in the second largest 
or half largest unused ares, whichever is 
larger. 



The PREFIX command is specified by typing "P" for 
P(refix. PREFIX changes the current default to the 

Pagv AO 



volume specified. The user must entt?r a volume 10. 
The rest of a file specification is unnecessary. Tht? 
sipecified volume does not have to be on-l.ine« 

When "P" is typedf the File Handler responds tuith the 
prompt line: 

Prefix titles by what vol? 

The current default volume can be determined by 
responding to the prompt with ":". 



VOi,.llML-S 



The VOlUrtES command is specified by typing "M" for 
V<o1b- volumes lists all of the volumes currently on- 
line., along u>ith their associated unit (device) 
numbers. No prompt line is displayed and no file? 
specification is allowed. An example list of vo lumps 
is: 

Volumes on-line 

1 CONSOLE: 

2 SYSTERM: 

3 K ONDISK 

A PRINTER: 
Prefix is ~ ONDISK 

The asterisk («) denotes the system (or boot-disk) 
volume. This is the default volume unless the prefix 
has been changed (see PREFIX). Block-structured 
devices are indicated by "«" or "<♦". 



EXAMINE 



The EXAHINE command is specified by typing "X" for 
X(amine, EXAillNE attempts to physically recover 
suspected bad blocks that have been detected by the 
B(AD BLKS command. When "X" is typed, the File 
Handler responds with the following prompt line: 

Examine blocks on what volume? 

WJien the user responds by typing in a volume ID. the 
prompt is generated: 

Block number range? 

The user enters the block number (s) detected by tiie 
BAD BLOCKS scan. If any files are endangered, the 
following prompt appears: 

File(s) endangered: 
f i lename 

Page 41 



/Biii 



fry to fix them? 

A "Y" aifsiuer mil cause the l-iie Handler to examine 
the blocks and return either of the mesEages: 

Block < block number > may be ok 
Block < block number) is bad 

In the fir&t case., the bad block has probably already 
been fixed. In the second case, the Kile handler mi 11 
offer the user the option of marking the blocks. 

The user responds by qiviig the block number(5) of 
those to mark bad. These blocks will not be shifted 
by KRUNCH and will be rendered effectively harmless. 

An "N" answer to the "fix th(?m?" prompt returns the 
user to the outer level of thi3 File Handler. 

The volume to be examined must be on-line. 

UARHINQ: A block which "may be ok" is probably 
physically ok but may contain garbage. Fixing a block 
means that the block is ^ead> written out to the 
block, and read again. If th? two reads are the same, 
the message "may be ok" applies. If the reads are 
different, the block is declared bad and may be marked 
as such. 



The ZERO command is specified by typing "I" for 
'/Aeron ZERO reformats the spjcified volume, rendering 
the previous directory unobtainable. When "I" is 
typed, the File Handler responds with the following 
prompt line: 

Zero dir of what vol? 

The user then enters the volume ID» This is followed 
by the prompt line. 

Destroy (volume name) ? 

A "Y" answer prompts: 

Duplicate dir? 

If the answer is "Y". a duplicate directory will be 
maintained. In case the disk directory is destroyed, 
a utility COPYDUPDIR can use the duplicate directory 
to restore the disk. The File Handler will then give 
the current number of blocks an the disk and ask if 
that is the desired nufnber: 

Page ^2 



<curreiit nu/nber of blocks on disk) blocks? 

A "N" ansttfer generates a prompt requesting the desired 
number : 

« of Blocks? 

Table 2-1 gives the correct number of blocks for 
several types of dis-ks, A "Y" anstuer to "current 
number of blocks" generates: 

hteui vol name? 

The user can enter any valid volume name. The file 
Handier then queries to validate the name: 

<netu volume namt) correct? 

A "Y" answer causes the File Handler to generate the 
message: 

<new volume name) zeroed 

A "H" answer to the "new volume name" question and to 
the questions "destroy volume name" and "duplicate 
directory" returns the user to the outer level of the 
File Handler. 

Table 2-1. BLOCK QUANTITIES ON DISK 



NO OF DISK TYPE 
BLOCKS 



156 Single-density^ soft-sectored* 5 1/4" 

floppy 
312 Double-density., soft-sectored* 5 l/A" 

floppy 
624 Double-density* dual sided* soft-sectored* 5 1/4" 

floppy 
494 Single-density* soft-sectored* 8" 

floppy 
988 Double-density* soft-sectored* 8" 

floppy 
19/6 Double-density* dual sided* sot-sectored 8" 

floppy 



2.7 PASCAL COHPILER 

The Pascal Compiler is a one-pass recursive descent compiler. It is invoked 

Page 43 



by using the C(ompile or R<ut> cc»mmand5 in the Outer Level of the Pascal 
Operating System commanri'j^ 

The Compiler normally compiles the utork file^ iF one exists. Otherwise^ it 
prompts the user For a source file naflie by the following prompt line: 

Compile luhat text? 

DuriiiQ the course of compilation, the Compiler mill display messages on the 
operator's console detailing the progress of the compilation. Note that 
this display can be inhibited in one cif tu>o luays. The G+ (quiet compile) 
option, which is described later in this section* luill suppress the display. 
Also, if the HAS SLOU TER(1IHAI_ boolean in the system communication area is 
False, the display is suppressed (see Section '^. 1) . 

An example of the output to the opera1;or'5 console is shown in Figure 2-11. 
The identifiers appearing on the screen are the same as those in the program. 
The identifier for a procedure is displayed as soon as its compilation has 
started. The numbers appearing uii1;hin f H give the number of 16-bit luords 
available for synrfjol table storage at that point. The numbers within < > are 
the current line numbers. Each dot on the screen represents one source line 
compi led. 



!JEN).). TEXT 
Compiling. 



PASCAL Compiler r3.03 (Unit Compiler) 

< >..... , 

LAINIT [1710 luordsT 

<— 43> 

GETFILE ri692 words] 

<--52>,,...... 

WRITEIT [1674 wordsl 

<— 71> 

NEl*.IHE ri634 wordsT 

< —BA} 

<-134> , 

<-184>........ 

CtPYIT ri616 words] 

<-192>.. 

SEND ri627 words] 
< -205 >..... 

211 lines 

Smallest available space = 1616 loords 



Paje AA 



Figure 2-11. EXAMPLE OF COMPILER DISPLAY 

If no syntax errors are detected* the compilation is considered to be success- 
ful. In this case* the Compiler writes a code file called "SYSTEM.WRK.CODE to 
disk. This is the code file that is executed if the user has specified the 
K(un command. 

When the Compiler detects a syntax error* the symbol in the source where the 
error is detected is indicated by the marker "<<<<" and the text surrounding 
the error and an error number are displayed. If both the Q+ (quiet compile) 
and L+ (list source on disk) options are selected* the compilation titill 
continue with the syntax error being listed on the file and thf console 
remaining undisturbed. 

If those options are not selected* the Compiler gives the user the choice of 
three options — typing (space)* <esc> or "E". 

A (space) instructs the Compiler to continue luith the compilation* an (est) 
causes termination; and "E" is an E(ditor command that puts the system under 
control of the Editor with the cursor located at the error. Syntax errors 
are listed in Appendix B»2. All error numbers mill be accompanied by a 
text message of explanation on entry to the Editor if the file "SYSTEM. SYNTAX 
is available. 

2.7;.! Compiler Option Syntax 

The Compiler may be instructed to generate code according to certain options. 
These options are written as comments in the program text and are preceded by 
a dollar sign (*). The general format is: 

(«■$< option sequence) (any conwnent)*) 
Where (« and «) bracket a comment. 

In the option sequence* options are separated by commas. Each option is 
designated by a letter followed by either a plus* if the option is to be 
activated* or by a minus* if the option is negated. When "+" or "~" is 
not specified* a + is assumed. When default options are desired* they do not 
need to be included in the option sequence. Three of the options may be 
followed by file names rather than "+" or "~", They are I (when including 
another source file)* L (when listing to a non-default destination)* and 
U (when naming the system library file). 



D 



The D option causes the Compiler to issue breakpoint 
instructions in the code file during compilation so 
that the Debugger can be used more effectively. The 
default value is D--, The effects of "+" and "-" are: 

D" Omit breakpoint instructions during compilation. 

Page A5 



F)+ Insert breakpoint mstructions- 



The G option affects the boolean variable GOTOOK in 
the Compiler. This boolean is used by the Compiler to 
determine whether it should alloui the use of the 
Pascal GOTO statement within the program. The default 
value is G- . The effftts of "+" and" "-" are: 

G~ Generate a 'syntax errcr on encountering a GflTD 

5tr3tementr 
G+ A 1 lout the UB-e of the GOTO statement. 

NOTE: In the Pascal proc^rafn, in some cases luhere the 
GOTO statement may be used/ other statement such as 
FOR* WHILE or REPEAT may be more appropriate- 



The I option has tmo forms. When it is followed 
immediately by a "+" or "-"> it affects the boolean 
variable lOCHECK in the Compiler. Uhen it is 
follottied by a file name* it causes the Compiler to 
include a different source file into the compilaton at 
that point. 

Uhen foliotued by "+" or "-", the default value is I+- 
The effects of the signs are: 

!♦ Generate code after each I/O statement to see 

if the I/O tuasaccodtplished successfully. If not> 
the program will btf terminated uiith a runtime 
error. 

I- Do not generate any I/O checking. In case of an 
unsuccessful I/O operation* the program is HOT 
terminated aiith a runtime error. 

The I- option is frequently used luith system level 
programs that already check the lORESULT function 
after each I/O operation. The system program can 
then detect and report I/O errors without terminating 
abnormally. Homever, this maij be at the expense of 
increased I/O errors and possibly severe program bugs. 

The syntax for instructing the Compiler to include 
another source file is: 

<«1il<file name) k) 

The comment must be closed at the end of the fiit? 
name» and no other options can follom. If a file name 
starts with a "+" or "-"> a blank must be inserted 

Pace A6 



betiBoen the "I" and the file name. 

If the initial attempt to open the included file 
fails^ the Compiler appends ".TEXT" to the name and 
tries again. If the second attempt fails* or if an 
I/O error occurs tuhile reading the included file* the 
Compiler responds u»ith a fatal syntax error. 

An included file may be inserted at any point into th(7 
original program* provided the rules governing the 
normal ordering of Pascal declarations mill not be 
violated. The Compiler tuill even accept included 
files that contain the declarations CONST* TYPE* VAR, 
PROCEDURE and FUNCTION even though the original 
program has already completed its declarations. To do 
so* the "I" comment must appear between the last VAR 
declaration and the first PROCEDURE or FUNCTION 
declaration of the original program. 

The Compiler cannot keep track of nested include 
comments. If an included file contains another 
include comment* a fatal syntax error utill be 
generated. 

The include comment is useful for compiling very large 
programs in smaller* more easily managed segments. 



The L option tells the Compiler whether to generate a 
source program listing to a given file. The default 
value is L-. The effect of the sign is: 

L" No compiler listing mill be made. 
L+ The compiler listing will be sent to a disk 
file named "kSYSTEII.LST.TEXT". 

The user may override this default destination by 
specifying a file name following "L". To specify a 
file name within a control comment* refer to the 
description of the "I" option (include another source 
file). 

NOTE: The file containing the program listing may be 
edited the same as any other file if the file name 
contains the suffix ".TEXT". Otherwise* the file 
will be treated as data rather than text. 

>4ext to each source line in the program listing* the 
Compiler lists the line number* segment procedure 
number* procedure nus^er and the number of bytes or 
words (bytes for code, words for data) required by 
that procedure's declarations or code to that point. 
The Compiler also indicates if the line is within the 

Page A7 



code to be executed or ir> part of the declarations for 
the procedure by flagging the line uiith "D" for 
declaration and an integer (0 throuc^ 9) for the 
lexical level of statement nesting uiithin the code 
part. If the D+ option is selected, the listing luili 
include an "«" to specif u breakpoints. 



The Q option is for the "quist compiler". It is used 
to suppress the output of procedure names and line 
numbers detailing the prognsss of the compilation to 
the operator's console. The di'fault value is set to 
the current value of the SLOUTERfl attribute of the 
system communication recorJ SYSCOfl^ (actually 
SYSCOn^.niSCINFO.SLOUTERII). The effect of the signs 



(}+• Suppress output to the CONSOLE device. 
Q" Send procedure name and line number output 
to the CONSOLE device. 



The R option affects the valus of the boolean variable 
RAWGECHECK in the Compiler. If RANGECHECK is True, 
the Compiler utill output additional code to check on 
array subscripts and the assignments to variables of 
subrange types. The default value is R+- The effect 
of the signs is: 

R« Turns on range checking. 
R~ Turns off range checking. 

MOTE: Programs compiled mith the R- option selected 
twill run slightly faster. Hotuever. if an invalid 
index occurs or if an invalid assignment is made* the 
program mill NOT be terminated uiith a runtime error. 



The S option determines whether the Compiler ujill 
operate in swapping mode. In snapping mode* only one 
of the tiBo main parts (declarations or statements) is 
in main memory at one time. This makes an additional 
2!500 luords available for symbol table storage. 
However, compilation is slower. On full size* single- 
density floppy disks* the compile time is doubled, 
This option must be set before the Compiler encounters 
any Pascal syntax. The default value is S-. The 
effect of the signs is: 

Sf Puts the Compiler in swapping mode. 
S" Puts the Compiler in nonswapping mode. 

Page AQ 



This option sets the boolean variable SYSCOtIP in the compiler 
iBhich is used to determine whether the compilation is a uber 
program compilation or a system program compilation. The 
default value is U+« The effect of the signs is; 

U+ The compilation is to take place on the user program 

lexical level. 
U- Compilation is to take place at the system lexical 

level. This also sets the following options: R-,. 

G+> and I-, 

NOTE; Selecting U- will generate programs that may not 
behave as expected. It is not recommended for non- 
systems work without knowing the method of operation. 

The U option also is used to name a library file. The 
named file becomes the file in which subsequent USEri 
UNITS are sought. The default file for the library is 
"»SYSTE!1. LIBRARY". 

An example of a USES clause with the U option is given 
below. 

USES UHITA,UNITD, Found in «SYSTEI1. LIBRARY 
W NEW. CODE 

UNITB 
W OLD. CODE 

UNITC, UNITE; 



2.8 BASIC COilPILER 

The Basic Compiler has been written in the Pascal language. It is invoked 
the same as the Pascal Compiler as a result of the C(ompile or U(un command 
given when at the Outer Level of commands for the Pascal Operating System. 
The file name for the Basic Compiler must be changed from its or;iginal 
name of BASIC. COMPILER to "SYSTEM. COMPILER for it to be invoked by the system. 
Thus, only one compiler will be in the system configuration, Basic or Pascal. 

The Basic program is created by using one of the system editors. The main 

features of UCSD Basic are described below in sufficient detail for those 

who are already familiar with Basic to understand what is required by this 
Cofiffdler. 

2.B.1 Features of UCSD Basic 

The Basic Conqjiler has real and string variables. When a real variable is 
applied to indexing or other integer purposes, the rounded value of the number 
is used. In the functions described below, "x" and "y" can be real variables 
or expressions which are equivalent to real variables. In like manner, "si" 
and "s2" can be string variables or expressions which are equivalent to a 

Page A9 



string. 
VARIABLE NAHES 

Real variables: letter (di^jit) 

String variables: letter (digit)*. (The digit is optional.) 
INTRINSIC ARITHHETIC FUNCTIONS 

ATN(x) Returns the angle in radians whose tangent is x. 

EXP(x) Returns the base of the natural logarithms raised 
to the pomer of x. 

INT(x) Returns ths value of x rounded to the nearest integer. 

LOG<x) Returns the log (base 10) of x. 

LN(x) Returns the natural log of x. 

l10D(x*y) Returns x to nodulo y 

SIN(x) Returns the s:ine of angle x, where x is in radians. 

COS(x) Returns the cosine of angle x, inhere x is in radians. 

INTRINSIC STRING FUNCTIONS 

CAT*(sl>s2>. . .) Returns a string uihich is equal to the concatenation 
of all the sti'ings in the parameter list. 

COP$(sl,x,y) Returns a copy of a portion of the string si. y 

consecutive ciaracters. starting with the character 
position X. 

DEL*(sl.x,y) Returns the contents of the string si with y consecu-- 
tive characters deleted* starting with character 
position X. 

INS*(sli52. X) Returns the contents of 52 luith si inserted immediately 
before character position x. 

LEN*(sl) Returns the length of the string si. 

P0S$(sl,s2) Returns an integer that is equal to the position of 
the first character in the first occurrence of the 
string si in the string s2. 

OThffR FUNCTIONS 

0RD(5) Returns the ^SCII value of the first character of the 
r>tring(s). 

P8.ge 50 



STR*<x) 



GET* 



OlDtcs) 
hEU<c,s) 



Returns the string containing the character associated 
fflith the ASCII value x. 

Reads a single character from the keyboard utithout; 
prompt or echoing, and returns it as a string; no 
arguments are required. 



The numeric constant c (no fraction part) becomes 
associated uiith the disk file tuhose name- xr> in '_.„ 
OLD expects the file to already exiivb; NEW creates 
a new one uiith the name s, removing tiny previous 
file of that name. These functions must occur aefore 
related print or input statements. The numbers .'nay 
be reassigned, and must be in the range to 16. For 
best results, use only at the beginning of a prograni.. 
".TEXT" must be appended to the file name i-or the fii<> 
to be edited by either of the system editors^ ifiese 
functions return lORESULT. 



PROGRAimiNG STATEMENTS 



Arithmetic statements and operations 
"■/ + subtract, add 
/, K divide, multiply 
'^, KK exponentiation 

Relational ofjerators 
= equa Is 
>, X not equals 

greater than 

less than 
=,-> greater than or equal 
",=< less than or equal 



INPUT list 
INPUT Uc list 



Inputs from the main system device, usually the 
keyboard. If the optional «c is present, input is from 
the disk file number c. The input list may contairf 
any combination of real and string variables. When 
a program expects input, the prompt "?" is printed. 
Input of real numbers may be terminated with any 
non-numeric character. Input of strings must be 
terminated luith a <ret>. 



Page 51 



determined by the variable name. The array indices 
are 0,.nlj0-.n2* . „ . Both real and string jnulti- 
dimensional arrays can be used. If no dimensions arp 
declared, they are assumed to be O.-IO, 0..10, 0. . t. 
0..1,. . . The number of dimensions automatir.ally 
declared depends on the number that are used in the 
program, but must be constant over all u&es of the 
array. 

GOSUB linenumber Executes a subroutine call. The calling address 

is placed on the subroutine stack. Subroutint? calls 
may be recursive- 

RETURN Returns to the line after the last GOSUB that is still 
pending. It pops the top address off the stark and 
uses it as the return address. A RETURN tuhen no 
GOSUBs are pending is an error, 

GOTO linenumber Program execution jumps to the given line number, 
REM text Remark line. 

2,8.2 UCSD Basic Enhancements 

The following are unique to UCSD Basic: 

o For loops, var=expl is done before exp2 or exp3 are evaluated. 

o Continuation of statements is allowed. Any line not beginning 
luith a line number is assumed to be a continuation. 

o All parameter functions are called by value. Parameters cannot be 
used to return values from a function. Function calls are ailoiued 
to be recursive, 

o Arrays of more than two dimensions are a Hooted. String functions 
and procedures are those found in the UCSD Pascal language- 

o Tab stops are not allowed in printing. All list elements are 
printed without spaces between them. The carriage return can be 
suppressed by "i; " as the last symbol of the line„ 

o Subroutines may be recursive. 

o In-line comments may be inserted. The portion of any line following 
"«" is ignored by the Compiler. 

o The code of PASCAL FUNCTIONS may be added to the Basic Compiler as 
new standard Basic functions. This is accomplished by t) straight- 
forward addition to the Basic Compiler, 



2.9 LINKER 

The Linker allows the user to combine pre-compiled Pascal files so that they 

Page 53 



may be executed as one file. Normani}.. the p re-compiled files are re?,ide7it in 
the file KSYSTEil. LIBRARY and are combined luith the current work file- 
In waiting programs that utilize pre-compiled routines or subprograms., the 
user must declare them in the calling program to be EXTERNAL^ or as SEGMENT 
PROCEDURES much as PROCEDURES or FUNCTIONS may be declared tu be FORWARD (see 
Section 3.3 for further details on segmenting a program), fhe Compiler will 
then inform the system that linking :.s required before execution. The Linker 
also can be used to link in UNITs.. groups of routines that will be used 
together to perform a common task. Any files that reference UNITs or EXTERNAL 
routines and have not yet been linked may be compiled and saved, but must be 
linked before execution. 

2.9.1 Using the Linker 

The Linker may be entered by typing either "L" for L( inker for "H" for R<un 
when in the Outer Level of commands. The Linker must be invoked explicitly in 
the following cases: 

o If the file into which the routines are to be 
linked is not the work file. 

o The external routines to be linked reside in 
library files other than HSYSTEn. LIBRARY, 

When "L" is typed, the Linker responds with the following prompt: 

Host file? 

The host file is the file into which the routines or units are to be linked. 
If the work file is to be used, an asterisk and a return is typed rather than 
3 file name. Any file name entered will automatically be appended with 
".CODE" by the Linker. The Linker than asks for the name<s) of the library 
file(s) in which the units or external routines bt(? to be foimd; 

Lib file? <codefilE identifier) 

Up to eight library file names may be entered. Typing an asterisk (k) and a 
return ieill cause the Linker to reference the kSYSTEH. LIBRARY. The Linker 
notifies the user about each library file that is successfully opened.; for 
example: 

Lib file? k <ret) 

Opening hSYSTE»1-LIE:RARY 

When all library file names have been entered, the user must type a return to 
proceed. The Linker then prompts with: 

Hap file? (file identifier) <ret) 

The Linker writes the map file to the file requested- The map file contains 
information relevant to the linking process. Responding with a return will 
suspend this option. Unless a period is the last letter of the file name, the 

Page 5^ 



Linker will automatically append ".TEXT" to the name» 

After the Linker has read all of the segments required to enable the linking 
process, it prompts the user for the destination file name for the linked code 
output: 

Destination File? 

The destination file often u>ill be the same as the host file. Linking luil), 
be.qin after a (return) is typed folloujin.g the output file name. Gimpiy a 
(return) only causes the output file to be placed on the mrk file. 
KSYSTEH.WRK.CODE. 

During the linking process, the Linker mill report on the operator's console 
all segments being linked and all external routines being copied into the 
output file. The linking process will be aborted if any required segsients or 
routines are missing or undefined. The user will be informed by one of thf> 
following messages, as appropriate: 

Unit < identifier) undefined 

Proc (identifier) undefined 

Func (identifier) undefined 

Global (identifier) undefined 

Public (identifier) undefined 

When typing "R" for R(un, if the program in the work file contains EXTERNAL 
declarations or uses UHITs, the Linker is automatically invoked after the 
Compiler. The Linker will search the ttSYSFEI-L LIBRARY for the routines or 
units specified and will attempt to link them. 

If the routine or unit is not in the kSYSTEH. LIBRARY, the Linker will respond 
with one of the messages given above, as appropriate. 

2.9.2 Linker Conventions and Implementation 

A codefile may contain up to sixteen segments. Block of the program code 
file contains information regarding name, kind, relative address and length of 
each code segment. This information is called the segtable, and is formatted 
in a record as follows: 

RECORD 

DISKIhFO: ARRAYfO. . 1!>D OF 
RECORD 

CODELENG, CODEADDR: INTEGER 
END 
SEGNAME: ARRAYfO. . 153 OF PACKED ARRAYfO. , 73 OF CHAR; 
SEGKIND: ARRAYfO. . 15D OF (LINKED, HOSTSEG,SEGPROC,UNITSEG, 

SEPRTSEG) i 
TEXTADDR: ARRAYfO. . 153 OF INTEGER; 
END 

Page 55 



CC»ELENG pives the length of the siepuient in tuords. and CODEADDR gives the 
block address. A description of EJEGKIND folloius: 



LIHKED 

HOSTBEG 

5EGPR0C 
UNITSEG 
SEPRTSEG 



The code segment is fully executable. Either oil 
external references have been resolved or none were 
present. 

The outer blcck of a Pascal program if the program 
has external references. 

A Pascal segment procedure- 

A compiled segment. 

A separately compiled procedure of function <e.g»^ 
assembly language code files or Pascal UNIls that are 

not segheht units. 



If a segment contains unresolved external references, the Compiler generates 
linker information. This informa^iion is in a series of variable- length 
records, one for each UNIT, routine or variable that is referenced in but is 
external to the source. The first e:;ght utords of each record contain: 

l,IENTRY=RECOKD 

NAflE: ALPHA; 

CASE LITYPE: LITYPES Of 

IJNITREF", 

GLOBREF, 

PUBLREF, 

PRIVREF, 

SEPPREF, 

SEPFREF, 

CONSTREF: 

(FORHAT: OPFORtlAT; 



NFEFS: INTEGER; 

NUORDS: LCRAHGE); 
GLOBDEF: 

<HOnEPROC: PROCRANGE, 
ICOFFSET: ICRANGE) ; 
PUBLDEF: 

(BASEOFFSET: LCRANGE); 
CONSTDEF. 

(CONSTVAL: INTEGER); 
EXTPROC. EXTFUNC, 
SEPROC, SEPFUNC: 

(SRCPROC: PR0CRAN(;E, 
NPARAHS: INTEGER); 
EOFHARK: 

(NEXTBASELC; LCRAH(;E) ; 
END<lientry) 



format of lientry; name can be BIG, 

BYTE, or WORD 

♦♦ of references to lientry nt>me in 

compiled code segment 

size of privates in wordt;- 

which procedure it is in 
byte offset in p-code 

compiler -assigned word offset 

user's defined value 



procedure tt in source segment 
It of parameters expected 

private var allocation info 



fage 56 



If the LITYPE is one of the first case variant, a list of code pointers into 
the code segment fol lotus this portion of the record- Each pointer is the 
absolute byte address within the code segment of a reference to a variable, 
UNIT or routine named in lientry. These are 8~u)ord records; but only th«? 
first NREFs are valid. 



2u 10 DEBUGGER 

The Interactive Debugger is included in the Pascal Operating System to 
facilitate debugging the Pascal program. For optimum use of the Debugger, two 
Compiler options should be turned on: D+ and L+. The D+ option generates 
breakpoint instructions luithin a program as it is being compiled. The break- 
points ave necessary for the use of the Crauil, Walk or Breakpoint commands. 
The L+ option writes a compiled source listing of the program on disk. Ihe 
Debugger uses this listing (file name «SYSTEri.LST.1EXT) while in the CRAWL or 
WALK mode or when a breakpoint is executed. 

Both options have their drawbacks. D+ causes a sightly larger code file to be 
created; L+ requires space on disk. However, these options can be turned on 
and off as needed so that they can be activated for troublesome pieces of 
code only, if desired, 

A sample program to be debugged is shown in Figure 2~12. In the compiled 
source listing shown, the first column contains the line numbers, the second 
has the segment numbers, and the third, the procedure numbers. In the 
procedure number column, as asterisk (k) after the number indicates that the 
line has at least one conditional halt (breakpoint) associated with it; 
otherwise, a colon (:) appears. The letter following the asterisk or colon 
indicates whether the offset represents a code (C) or data (D) off&et. If the 
offset is "C", the offset for that procedure is given as the first instruction 
generated for the line. If the offset is "D", the number given as the first 
instruction represents the word offset in the data area where storage for that 
line of the procedure begins. 

11 1:D 1 («$D+,LDEBUG.TEX1K) 



2 




1:D 


1 


PROGRAO DEBUG; 


3 




1:D 


3 


VAR A : INTEGER; 


A 




1:D 


A 




5 




2:D 


1 


PROCEDURE DIVIDE; 


6 




2:D 


1 


VAR B : REAL; 


7 




2:0 





BEGIN (KDIVIDE«) 


8 




2K1 





B := 5/A; 


9 




2K0 


11 


END (MDIVIDEK); 


10 




2:0 


26 




11 




1:0 





BEGIN («DF.BUGK) 


12 




1«1 





A := 0; 


13 




1«1 


7 


DIVIDE; 


1^ 




1«0 


11 


END (KDEBUG«). 



Page 57 



The debugger is entered by tiding "D" for D(ebug» rather than "H" for R(un> 
while in the Outer Level of cofflmands for the Pascal Operating System. If the 
program work file has not been compiled* the Compiler will be called first, 
automatically. However, if a runtime error occurs during compilation, or if a 
breakpoint or halt is encountered. Debugger is called. 

After "D" is typed, the Debugger displays a message giving the release number 
and date of the release: 

PASCAL INTERACTIVE DEBUGGER - January 1978 

The Debugger is in EXATIINE mode mh-sn entered. This mode is used to peruse 
portions of memory, set or clear breakpoints, resume execution of the program, 
or enter WALK or CRAWL mode to exec jte the program one statement at a time. 
The execution options are prompted by: 

>EXAI1INE: 1.. < (links, n(ove, <, >, L(ink, D(ata, S(tack, H<efip, 
E<r3se, U(pdate, <crtl-U(p>, <crtl--D<oii>n>, C(rau»L U<alk, R<esuffle, 

<€»SC > 

RCesume runs the program normally until a BREAK or breakpoints are encountered 
or a non-fatal runtime error occurs. C(rau»l puts the program into the CRAWL 
mode to execute one statement at a time, waiting for input from the user 
between steps, W(alk puts the program into WALK mode to execute the program 
one statement at a time at an adjustable rate. The other commands are 
described later in this section. Whenever the EXAMINE mode is enttred, the 
prompt line appears. If entered as a result of an execution error, additional 
information is given, as shown in Figure 2-13. 

(KtD-t-,LDEBUG.TEXTK) 
PROGRAtl DEBUG; 
VAR A : INTEGER; 

PROCflDURE DIVIDE; 
VAR B : REAL; 
BEGIN <«DIVIDEK) 

8 :== 5/ A; 
END (ttOIVIDEK); 

BEGIN (KDEBUGK) 

A :== 0; 

DIVIDE; 
END IKDEBUGK). 

Figure 2-13. EXAI1PLE OF ENTERING EXAMINE MODE 

The bottom line gives the reason athy the EXAMINE mode was entered. It may 
be some type of execution error, a usfr break, termination of WALK or CRAWL 
mode;, or execution of a breakpoiitted statement. In the case shown above, 
it was a floating point error <a divide by zero, to be specific). The 
procedure in which the error occurred is given by Proc and Seg, 

In the CRAWL mode, information about a statement is given prior to its 
execution. If »«SYSTEM.LST.TEXT exists, the compiled listing line containing 

Pajje 58 



the statement is displayed. Othertt»ise> the information displayed includes 
the line number/ the number of the segment and procedure* and the code offset 
of the first instruction. The user then has tuio options. 

If < space) is typed* the Debugger will execute the line and continue. If 
"Q" is typed, the Debugger luill leave the CRAUL mode and reenter the EXAtllNE 
mode. 

As in the CRAUL mode* when in the WALK mode information is displayed prior 
to execution of the statement. On typing "W" to enter the WALK mode* the 
following prompt line appears: 

DELAY: 

The user then enters an integer that the Debugger uses as the number of 
seconds to delay between executing each statement in the program. The BREAK 
key is used to reenter the EXAHINE mode. 

2.10.2 Commands 

An example of how the commands are used to debug a program is given in Figure 
2-14. The commands are described below. 



« LINKS 



novL 



Entering a number between and 9 gives the number of links to move 
up or down the dynamic or static chain. The direction is determined 
by the first character of the EXAHINE prompt line. A forward arrow 
indicates that movement will be in the direction of the older calls 
(if dynamic) or ancestors <if static). The reverse arrow indicates 
that movement will be towards more recent calls. The type of links 
to be traversed* STATIC or DYNAIIIC* is specified to the right of 
DEFAULTLINK (as shown in the example in Figure 2-12). 

NOTE: Movement towards descendents is not allowed. 



Typing "II" specifies the IKove command that is used to find a 
specified procedure and make it the current procedure. This command 
has two parameters: 

PROC 

Procedure number of the desired procedure. Default is the number 
of the bombed procedure (the one at the bottom of the call chain). 
Typing < return) will give the default and bypass the normal 
search. 

SEG 

Segment number of the desired procedure. Typing < return) will give 
the default segment (which must be preceded by a (return) for the 
default procedure). 

Page 59 



Figure 2-1^. USING DEBUGGER COilllANDS TO DEBUG A PROGRAn 

After the procedure and segment numbt?rs have been entered, the Debugger mill 
search up the dynamic links starting at the caller of the current procedure. 
Note that this implies that one can never move to the current procedure 
because the Debugger mill not find it. If the specified procedure is found., 
it becomes the current procedure and the information in the prompt line u»ill 
be ^jdated. Othermise. the current procedure remains unchanged. 



< 



.INK 



DATA 



Typing "< " or "/" changes the direction of link traversal (movement) 
to be down the call chain 'ii.e.. go touiards the callees). 



Typing ">" or "." changes the direction of link traversal to be up 
the call chain (i.e.. go ttMuards the callers). 



Typing "L" specifies thi? Kink command to toggle the DEFAULTLINK 
from DYN^IC to STATIC, and vice versa. 



Typing "D" specifies the DIata command to examine the data and 
parameter segment of a procedure. The Debugger prompts for four 
parameters: 



The only parameters that noed to be entered are those other than the 
defaults. Typing <cr> at jny point tells the Debugger to use the 
default values for the remaining parameters. Typing (space) 
delimits a parameter and lets the Debugger prompt for the next one. 
The parameters are: 

OFFSET 

Default value is the last offset displayed plus 1. Beginning value 
is i. The offset may be changed by entering an integer. 

LENGTH 

The beginning default value is the minimum of the text buffer size 
(15 for 24-line screens) and DATA plus PARAH. After that, it is 
the last length specified in the D(ata or S<tack command- LENGTH 
determines the number of mords to be displayed- 

PROC 

Page 60 



STACK 



HEAP 



ERASE 



UPDATE 



CRTL U 



The default value is the number of the current procedure. Athj 
procedure may be specified that is higher in the call chain. 

SEG 

The default value is the segment to which the current procedure 
belongs. 

When the Debugger finds the specified procedure, it will display the 
datai wrapping around to the top of the screen and erasing 
information in the memory display data bugger, if necessary. 

When an offset to be displayed is larger than PARAtI plus DATA for a 
procedure, the message is generated at the bottom of the screen: 

Warning - offset too large 

The invalid data will not be displayed- 



Typing "S" specifies the S(tack command that is used For examining 

the stack area belonging to a specific procedure. Parameters are 

specified in the same luay as for the DATA command; but the first 
offset is 0, not 1. 



Typing "H" specifies the H(eap command that displays a portion of 
memory specified by an octal address and a length. 



Typing "E" specifies the Etrase command that clears the memory 
display buffer on the screen. 



Typing "U" specifies the U<pdate command that refreshes the memory 
display buffer. S<tack, D(ata and H(eap commands save the procedure 
numbers and offsets displayed in the memory buffer, When "U" is 
typed, the buffer is erased. The saved numbers are i*sed to locate 
any information belonging there. UPDATE is not able to refresh any 
of the information that belongs to procedures that are below the 
current procedure in the call chain. It will generate the message: 

Proc not found. 



Typing "U" specifies the <CRTL-U(p> command that moves the asterisk 
(K) up one line^ 



Page 61 



CTRL-D 



CRAWL 



UAL.K 



RESum-: 



ESCAPE 



Typing "D" specifies the <CRTL-D(oiuti> command that moves the 
asterisk <«) doiun one line. 



Typing "C" specifies th€> CCrawl command that resumes execution of 
the program in CRAWL iDcde at the point in the program ©here the 
Debugger was invoked. 



Typing "W" specifies the W<alk command that resumes execution of the 
program in the WALK mode starting where the Debugger was invoked. 



Typing "R" specifies the R<e5ume command that resumes normal 
execution of the progra«!» luhere the Debugger mas invoked. 



Typing <e5c> specifies escape, return to the Outer Level of 
commands. 



CARRIAGE RETURN 



Typing <cr> specifies a carriage return that clears the line mith 
the asterisk («) and moves down one line. 



BREAKPOINT 



Typing "S" for S(et or 'C" for Cdear sets or clears a breakpoint. 
They both require line numters. 

SET 

Enter a line number of a line that has an asterisk in the compiled 
listing. Whenever a sttitement in that line is about to be 
executed; the Debugger u»].ll be called. 

CLEAR 

Enter <cr> to clear all tireakpoints or enter the line number of an 
acti>/e breakpoint. 



P.jge 62 



SECTION 3 



PASCAL PROGRAIiniNC CONSIDERATIONS 



Many aspects of the Pascal Operating System need to be considered when 
pro.gramminp in Pascal because they have an influence on how a program should 
be fflritten» These aspects are described in this section. 

3.1 IHTRINSICB 

Users of intrinsics should be fluent in Pascal and experienced in the use of 
the Operating System. All necessary range and validity checks are the 
responsibility of the user. Some intriniscs do no range checking. Those which 
are particularly dangerous are noted in their descriptions. 

The required parameters are listed along u»ith the function/procedure 
identifier. Optional parameters are in square brackets CIL The default 
values are in metabrackets O on the line below. Within each subsection, 
functions and procedures are given in alphabetic order. 

The following terms are used in the explanation of the Intrinsics: 



ARRAY 
BLOCK 
BLOCKS 

blocknuhber 

BOOLEAN 

CHARACTER 

DESTINATION 

EXPRESSION 
FILEJtD 



INDEX 



NUMBER 



RELBLOCK 



a PACKED ARRAY OF CHARacters 

one disk block* <512 bytes) 

an INTEGER number of blocks 

an absolute disk block address 

any BOOLEAN value 

any expression which evaluates to a character 

a PACKED ARRAY OF CHARacters to write into or 
a STRING* context dependent 

part or all of an exprssion* to be specified 

a file identifier* must be 

MAR fileid: FILE OF <type>i 
or TEXT; 
or INTERACTIVE; 
or FILE; 

an index into a STRING or PACKED ARRAY OF CHAR- 
acters* context dependent or as specified. 

a literal or identifier whose type is either 
INTEGER or REAL. 

a relative disk block address* relative to the 
start of the file in context* the first block 
being block zero. 



Page 63 



SlilPLVARIABLE 



SUt 
SOURCE 

SCKEEN 
STRING 



: any dec larecl PASCAL, variable mhich is. of ont? 
of the ^^olloiuin.g TYPEb; 

BOOLEAN CHAR REAL STRING 

or peeked array f..3 OF CHAR 

: an INTEIiER number of bytes or charactersi any 
integer value 

; a STRING or PACKED ARRAY OF CHARacters to be 
used as a read-only arrays context dependent 
or as specified. »« 

; an array V600 bytes long; or as needed 

: any STRING* call-by-value unless otherwise 
otherwise «.pcified> ie. may be a quoted 
string, or string variable or function 
(uhich evaluates to a STRING 



TITLE 
UNlTNUrtBER 

VOLID 



: a STRING consisting of a file name 

: physical device numbr used to determine 
device handler used by the interpreter 

: a volume identifier. STRING 171! 



K« in string intrinsics. SOURCE is uoing to have to be a string, in .mtrinsics 
that deal uiith packed arrays of characters, it may be eithf?r» A ujorri of 
caution about using STRINGS in intrinsics that expect character arrays, the 
zeroeth element of the string) is the length byte, which may cause the 
programmer some unexpected problems luere he not aware of that fact-, 

3.1-1 Character Array llanipulation Intrinsics 

The Character Array llanipulation Intrinsics are byte oriented- No range 
checking of any sort is performed on the parameters passed to them; so handle 
with care. The user must know wfiat he is doing because the system does not 
protect itself from these operations. Examples are shown in f i.qure -J-l. 
The intrinsic 5I2E0F (Section 3.1.4; is meant for use with these intrinsics 
to "remember" the number of bytes oi- a parameter. 



Example of SCAN: 



PROGRAM SCANTESTi 

VAR EX : PACKED ARRAYr0..373 OF CHAR; 
I : INTEGFlRi 

BEGIN <hSCANTESTk) 
EX := ' EXAMPLE Of CHARACTER ARRAY INTRINSICS' i 
I := SCAN(-25. = ':Mi-Xr253); 
WRITELN (I)i 



Page 64 



I := SCAN(100,<>' ',EXr03)> 
WRITELN (I); 
END (KSCANTESI«). 



Examples of nOVELEFT 
MOVER IGHT 



PROGRAil nOVETESTi 

VAR BUFl : PACKED ARRAY TO.. 193 OF CHARi 
BUF2 : PACKED ARRAY TO., 203 OF CHARi 

BEGIN («I10VETESTK) 

BUFl := 'MOVE CHARACTERS LEFT'i 

BUF2 := 'THESE CHARACTERS '; 

t10VELEFT(BUFl, BUF2, 5) ; 

WRITELN (BUF2); 
END (unOVETESTK). 



Figure 3-1. EXAMPLES OF CHARACTER ARRAY MANIPULATION INTRINSICS 

FUNCTION SCAN <LENGTH, PARTIAL EXPRESSION, ARRAY) : INTEGER; 

This function returns the number of characters from the startin.0 
position to where it terminated. Termination comes when matching the 
specified LENGTH or satisfying the EXPRESSION. The ARRAY should be 
packed and may be subscripted to denote the starting point. If the 
EXPRESSION utas satisfied on the character at which ARRAY is pointed., 
the value returned will be zero. If the LENGTH passed was negative, 
the number returned will be negative and the function will have 
scanned backward. The PARTIAL EXPRESSION must be in the following 
format: 

"< >" or "=" followed by character expression 

PROCEDURE FILLCHAR (DESTINATION, LENGTH, CHARACTER); 

This procedure takes a (subscripted) packed array of characters and 
fills it with the number (LENGTH) of CHARACTERS specified. This can 
be done using a MOVELEFT procedure (described below); but FILLCHAR is 
twice as fast because no memory reference is needed for the source. 
FILLCHAR will optimize word moves only if the DESTINATION is below the 
I/O page. Word moves are not done to the I/O page because some 
hardware relies on byte addressing in this address space. 



PROCEDURE MOVELEFT (SOURCE, DESTINATION, LENGTH); 
PROCEDURE MOVERIGHT (SOURCE, DESTINATION, LENGTH); 

These procedures do mass moves of bytes for the LENGTH specified. 
MOVELEFT starts from the left end of the SOURCE and moves bytes to the 

Paoe 65 



left end of the DESTINATION, traveling right. MOW-RIGHT &t..-»rt5 from 
the right end, traveling left. Both are needed u»hen working on a 
single array in which the order of the characters moved is critical. 

nOVERIGHT never attempts to optimize u»ord movesa ilOVtlEFT mill 
optimize only if the DESTINATION is at an address belout the I/O page. 
Uord moves are not done to the I/O page because some hardware relies 
on byte addressing in this address space. 

3.1.2 I/O Intrinsics 

PROCEDURE CLOSE (FILEID OPTION); 

OPTIONS include ", LOCK", ", NORHAL", ", PURGE" and ", CRUNCH". 
Note the commas. 

A normal CLOSE is done uihen the OPTION is null. CLOSE simply sets 
the file state to closed. If the file utas opened using Rtl^ITE and 
is a disk file, it is deleted from the directory. 

The LOCK option u>ill cause the disk file associated with th{T- FILEID 
to be made permanent in the directory if the file is on a directory 
structured device and the file luas opened luith a REWRITE? otherwise 
a normal close is done. 

The PURGE option will delete the title associated with the FILEID 
from the directory. The unit will go off-line if the device is not 
b lock -structured. 

The intent of the CRUCH option is to lock a file with a minimum 
number of blocks of useful information. (This option is currently 
undefined. ) 

Regardless of option, all CLOSEs will mark the file closed and will 
make the implicit variable FILEID-^ undefined. CLOSEing an already 
closed file causes no action. 



FUNCTION EOF (FILEID) : BOOLEAN; 
FUNCTION EOLN (FILEID) : BOOLEAN; 



EOF and EOLN return FalstJ after the file specified is reset. They 
both return True on a closed file. If FILEID is not prei^ent, the 
fileid INPUT is assumed (e.g., IF EOF THEN. . .). When EOF (FILEID) 
is True, FILEID-^ is undefined. 

Wien GET (FILEID) sets F::LEID'^ to the EOLN or EOF character, EOLN 
(FILEID) will return True, and FILEID-^ (in a FILE OF CHAR) will be 
set to blank. 

Iftiile doing puts or writes az the end of a file, if the file cannot 
be expanded to accommodate ;he PUT or WRITE, EOF (FILEID) will return 
True. 

P.jge 66 



PROCEDURE GET (FILEID)j 
PROCEDURE PUT (FILEID)j 

GET (FILEID) u»ill leave the contents of the current lociiral record 
pointed at by the file pointers in the implicitly declared mindoiy 
variable FILEID'^ and increment the file pointer » 

PUT (FILEID) puts the contents of FILEID*^ into the file at the location 
of the current file pointers and then updates those pointers,. 

Both procedures are used on typed files/ files for which a type is 
specified in the variable declaration (i.e.> "FILEID : FILE OF type ")« 
Untyped files are simply declared as " FILEID: FILE;". "F: FILE OF 
CHAR" is equivalent to "F: TEXT". In a typed file> each logical 
record is a memory image fitting the description of a variable of the 
associated <type>. 

FUNCTION lORESULT : INTEGER; 

After any I/O operation* lORESULT contains an INTEGER value that 
corresponds to the values ^given in Appendix B.3, 

PROCEDURE PAGE (FILEID); 

PAGE (FILEID) sends a top~of-form (ASCII FF) to the file. 



PROCEDURE READ<LN> (FILEID. SOURCE); 
PROCEDURiE URITE-CLN> (FILEID, SOURCE); 

These procedures may be used only on TEXT (FILE OF CHAR) or 
INTERACTIVE files for I/O, The three types of INTERACTIVE files 
are INPUT, OUTPUT and KEYBOARD. INPUT results in echoing of characters 
tvped to the console. OUTPUT alloius the user to halt or flush the 
output. KEYBOARD does no echo; it allows the programmer complete 
response to user typing. 

If "FILEID," is omitted, INPUT or OUTPUT (as appropriate) is assumed. 
A READ (STRING) will read up, but not including, the end-of-line 
character (carriage return) and leave EOLN (FILEID) True. This means 
that any subsequent reads of string variables will return the null 
sbring until a READLN or READ (character) is executed. 



PROCEDURE RESET (FILEID, TTITLED); 
PROCEDURE REWRITE (FILEID, TITLE); 

These procedures open files for reading and writing and mark the file 
as open. The FILEID may be any Pascal-structured file. TITLE is 
a string containing any legal file title. REWRITE creates a new 
file on disk for output files; RESET marks an already existing file 
open for I/O. If the device specified is a non -directory -structured 
device (e.g., PRINTER), the file is opened for input, output or 

Page 67 



both> in either case. 

If the file is already open tuhen the RESET or REWRITE is attempted/ 
an error is returned in lORESUl.T. The state of the file remains 
unchanged. 

RESET (FILEID) without an optional string parameter rewinds the 
file by setting the file pointers back to the bepinninq <0 record) 
of the file. The boolean functions EOF and EOLN luill not be set by 
the implied GET in RESET, 

With files of the INTERACTIVE sypei these functions act differently. 
On files of other types> RESET mill do an initial GET to the file., 
setting the windou) variable to the first record in the file. On 
INTERACTIVE files, RESET will not do the GET. 

PROCEDURE SEEK (FILEID, INTEGER); 

SEEK changes the file pointtjrs so that the next GET or PUT uses the 
INTERGERth record of FILEID. Records in files are numbered starting 
with 0. A GET or PUT must; be executed between SEEK calls because 
two consecutive SEEKs may causo unpredictable juni! to be held in the 
window and associated buffers. 

FUNCTION UNITBUSY (UNITNUMBER) : BOOLEAN 

This function ret-urns a boolean value. If the value is True, the 
device specified is waiting for an I/O transfer to complete. For 
example: 

UNITREAD (1<»C0NS0LEK), CHCOD, l(ttlcharacter), KkASYHCHk); 
WHILE UNITBUSY <1) ("while read hasn't taken place«) DO 
WRITEL.N CPlease type a character.'); 

Execution of the example will result in the continuous ouptut of the 
line ^Please type a character' until a character is typed. 



PROCEDURE UNITCLEAR (UNITNUHBER) i 

This procedure cancels all I/Os to the specified unit and resets 
the hardware to its po«»er-up state. 

PROCEDURE UNITREAD (UNITNUtlBER, ARRAY, LENGTH, rBLOCKNUilBERJ, TINTEGFR]); 
PROCEDURE UNITWRITE (UNITNUTtBER, ARRAY LENGTH, TBLOCKNUHBERT, CINTEGERD); 

{SEQUENT I AL> C(» 

These procedures are dangerous because no range checking is done. 

These are the low-level procedures that do I/Os to various devices. 
The UNITNU1BER is the integer name of the device. ARRAY is any 
declared packed array. It may be subscripted to indicate a starting 
position to do the transfers f "om/to. LENGTH is an integer giving the 

Pag.? 6H 



number of bytes to transfer, BLOCKNUilBER is required only when usin.q 
a block-structured device* and is the absolute block number where the 
transfer will start from/to. If omitted. BL0CKNUI1BER is assumed to be 
0. The INTEGER value is optional and assumed to be 0. If 1> it 
indicates that the transfer is asynchronous. If BLOCK- NUilBER is 
omitted, but INTEGER is included, a comma is used to hold the 
placement of parameters. 

PROCEDURE UNITWAIT (UNITNUHBER) j 

This procedure waits for the specified device to complete the I/O 
in progress. 

3.1.3 String Intrinsics 

To maintciin the integrity of the LENGTH of a string, only string functions or 
full-string assignments should be used to alter strings, iloves and single- 
character assignments do not affect the length of a string, which means that 
the programmer must do range checking. The individual elemi?nts of STRING are 
of CHAR type and may be indexed 1. . LENGTH (STRING). Accessing the string 
outside this range will have unpredictable results if range-checking is off. 
or may cjiuse a runtime error if range-checking is on. 

Examples of String Intrinsics are given in Figure 3-2. 

FUNCTION CONCAT (SOURCES) : STRING 

This function returns a string that is the concatenation of all the 
strings passed to it. There may be any number of source strings. 
'separated by commas. 

FUNCTION COPY (SOURCE. INDEX, SIZE) : STRING 

This function returns a string containing SIZE characters copied from 
SOURCE starting at the Ihfi)EXed position. 

FUNCTION LENGTH (STRING) : INTEGER 

This function returns the integer value of the length of STRING. 



Page 69 



PROGRAH STRINTST; 

MAR namejtext^pattern* first. second/ third : STRING; 
start.get; toofflany. more : STRING; 
long : INTEGERfB]; 
I : INTEGER; 

BEGIN (KSTRINTST«) 

I := LENGTH ( 'ABO; 

URITELN (I); 

name := 'JOHN SI1ITH'. 

T :- LENGTH<nam<?>; 

WRITELN<I); 

text := 'THIS IS AN EXAMPLE OF STRING INTRINSIC'; 

pattern : == 'EXA'; 

I := POS(pattern,text); 
MRITELN<I>; 

first := 'ABCDE'; 

second :='FGHIJ'; 

third := C(»ICAT(first, second); 

WRITELN (third); 

start := 'HERE IS A STRING OF CHARACTERS'; 
get := C0PY(5tart,P0S<'C', start), 10); 
URITELN (get); 

t^omany :='THIS STRING HAS TOO IIANY CHARACTERS'; 

DELETE(toomany, 17,9); 

URITELN(toomany); 

more :=' TOO HANY', 
INSERT (more, toomany, 16) ; 
l«ITELN(toofflany); 

long := 1000000; 
STR ( long, more) ; 

URITEU-l('$',more); 
EMD(KSTRINTSTfi). 



Figure 3-2. EXAMPLES OF STRING INTRINSICS 



Page /O 



FUWCTIDN POS (STRING, SOURCE) : INTEGER 

This function returns the position of the first occurrence of the 
pattern (STRING) to be scanned in SOURCE, The INTEGER value of the 
first position in the matched pattern will be returned. If the 
pattern was not found, zero mill be returned. 

PROCEDURE DELETE (DESTINATION, INDEX, SIZE) : STRING 

This procedure deletes SIZE characters from DESTINATION starting at 
t-he INDEXed position. 

PROCEDURE INSERT (SOURCE, DESTINATION, INDEX) 

This procedure inserts SOURCE into DESTINATION starting u>ith the 
INDEXed position in DESTINATION. 

'3,1. A fliscellaneous Intrinsic Routines 

PROCEDURE GOTOXY (XCOORD, YCOORD); 

This procedure sends the cursor to the specified coordinates. The 
upper left corner of the screen is assumed to be 0,0. This procedure 
defaults to a Datamedia-terminal. For systems other than Datamedia 
or Terak 8510a, a new GOTOXY must be bound in (see Section AAO) . 

PROCEDURE HALT; 

This procedure .generates a HALT opcode that causes a non-fatal runtime 
error to occur- When HALT is executed, the Debu^sjer is invoked. 
If the Debugger is not in core when a HALT occurs, a fatal runtime 
error will occur (#14). 

FUNCTION LOG (NUTIBER) : REAL; 

This function returns the log base ten of NUMBER. 



PROCEDURE JIARK (VAR HEAPPTR: '^INTEGER) j 
PROCEDURE RELEASE (VAR HEAPPTR: '^INTEGER); 



These procedures allocate and return heap memory allocations to the 
system. HEAPPTR is of tijpe '^INTEGER. ilARK sets HEAPPTR to the current 
top- of-heap. RELEASE sets the top-of-heap pointer to hEAPPTR. 

FUNCTION PWROFTEN (EXPONENT: INTEGER) : REAL; 

This function returns the value of ten to the EXPONENT power. 
EXPONENT must be an integer in the range of thrcMjgh 37. 

FUNCTION SIZEOF (VARIABLE OR TYPE IDENTIFIER) : INTEGER; 

This function returns the number of bytes that a parameter occupies in 

Page 71 



the stack. It is used with the FILLCHAR and flOVExxxx intrinbics. 

PROCEDURE TIIIE (VAR HIWORD> LOWORD: INTE.GER) i 

This procedure returns the current value of the system clork. (he 
value is given in 60th5 of '5econd> assuming a i6-bit integer size and 
a 32-bit clock uiord. HIWORD contains the most significant portion., 
Both mumD and LOWORD must be MARiables of type INTEGER. 

WARNING: The sign of LOWORD may be negative because thp time is 
represented as a 3i!-bit unsigned number- ihit; function 
currently is undefinecL 

3.^ FILES 

A file may be defined as a body of information that is stored on an l^O 
device. A file is referenced by the Pascal program and the Pascal Operating 
System by the file name. The suffix of the file name is dependent on file 
type. The follouiing types of files are used by the Pascal Operating System: 

Reserved 

Suffix Contents of i-ile 



.TEXT Human-readable text 

.CODE Hachine-exec'jtable code 

.DATA Data file 

.FOTO One Terak screen image 

.BAD A physically danaged area of disk 

3.2.1 Text Files 

The text file is composed of 1024-byte pages^ where a page is defined as: 

<rDLEJrindent3rtext3rCR3rDLE3rindent3rtext3rCRT. . ,rnulls3> 

Data Link Escapes are folloujed by an indent code, which is a byte that 
contains the value 32+ (number to indeni;)- The nulls at the end of the page 
folloju a carriage return in ail cases. They pad to the end of the page to 
give the Compiler integral numbers of l:ines on a page. The DLL and indent 
code are optional. 

The first page of a text file is the he.jder page that is reserved for infor- 
mation for the Text Editor. When a user program opens a text file and 
REWRITES or RESETS it with a title ending in ".TEXT", the I/O subsystem will 
create, then skip over, the header page. This page facilitates users in 
editing their I/O data. The File Handler will transfer the header page only 
on a disk-to-disk transfer, and will omit it on a transfer to a serial device 
(e.g., to a PRINTER or CONSOLE). 

3.2.2 Code Files 

The first block of information in a code file describes the code kept m the 
file. Heading the block is an array of 16 word pairs, a pair for each seoinent 

Page 72 



on the di'jk. The first word of the pair gives the block number no. thin the 
segment Vi»here code begins. The second tuord gives the number of bytt»; of code 
located there, 

FolloiBing this array is a series of 16 eight-character arrays that describe 
the segments by name. These eight characters identify the segment at compile 
time„ 

Then foLloius a 16~u>ord array of state descriptors.. The values in this array 
tell what kind of segment is at the described location,, The values iire; 

LINKED 

HOSTSEG 

SEGPROC 

UMITSEG 

SEPRTSEG 

The remaining lAA words of the block are reserved for future UBtt. 

3.2„3 Data Files 

The content and format of the data files are up to the ubsy. 

3. 2.'^ Foto Files 

Foto files contain screen images. Each one is declared in Pascal as follows; 

TYPE SCREEN = PACKED ARRAYCO, .239,0- .3193 OF BOOLEANi 
W\R FOTOFILE: PACKED FILE OF SCREEN 

3.2.5 Bad Files 

Bad files are those files that protect a user from using a physically bad 
block of disk. They are marked bad by the File Handler after a bad block scan 
has been done and the bad blocks have been examined (see Section 2.6)^ 

3.2.6 l-tork File 

In addition to the permanent files described above, the Pascal Operating 
System supports a work file that is a temporary copy of the file being 
modified. The work file is used by the File Handler, Editor and Compiler, 
When the text part of a work file is changed, the system stores it on disk as 
"«SYSTEi1.WRK.TEXT". Uhen the code version is first created, it is named 

"ksysteh.wrk.code". 

3.2»7 Volumes 

A volume is any I/O device. A block-structured device is one that can have a 
directory <e.g. , disk). A non~-b lock -structured device does not have an 
internal structure. It simply produces or consumes a stream of characters 
(e.g., printer and console). Table 3- 3 gives the volume names reserved for 
non -block-structured devices, the unit number associated with each device- and 
the unit numbers associated with the system and alternate disks. 

Page 73 



Psge 7 A 



FIGURE 3-3 I/O DEVICES 



UNIT 
NUrtEER VOLUtlE ID DESCRIPTION 



1 


CONSOLE: 


2 


SYSTERil: 


^ 


(volume name) 


5 


(volume name?) 


6 


PRINTER; 


3 


REMOTE: 


9-12 


(volume namt>> 



Screen and keyboard uiith echo 
Screen and keyboard without echo 
System disk 
Alternate disk 
Line Printer 
Additional peripherals 
Additional disk drives 



Volume names for block-structured devices can be assigned by the u&{?r» The 
name must not exceed seven characters in length and may not contain "=", "H", 
"?" or ",'\ The character "«" is the reserved volume ID of the system disk, 
the disk upon which the system luas booted. The character ":", when used 
alone, is the volume ID of the default disk. The system and default disks are 
equivalent unless the default prefix has been changed (see Section 2.6, 
PREFIX). "«(unit number)" is equivalent to the name of the volume in the disk 
drive at the current time. 



3.2.8 File Names 

A legal file name may not exceed 15 characters and may not include the 
characters "=", "$", "?" or ", ". Lower-case letters will be translated 
to upper case. Blanks and non-printing characters will be removed. Lecjai 
characters are the alphanumberics and the special characters "-•", "/" "\", 
"_" and ".", Special characters normally are used to indicate heirarchir. 
relationships between files and to distinguish related files of different 
types. The wild card characters "=" and "?" are used to specify subsets 
of the directory (see Section 2.6, File Specification) - 

3.3 SEGI1ENTS 

Segmenting a program so that procedures have to be in memory only when they 
are in use has many advantages: 

o Large pieces of one-time code (e.g., initialization procedures) 
can be put into a segment. 

o The work can be divided among several programmers, each coding, 
compiling and debugging his own segment, to be linked later by 
the Linker program. 

o A program can be configured to suit storage requirements. 



A maximum of six SEGMENT procedures are available to the Pascal programmer. 
The disk that holds the code file for the program must be on-line and in the 
same drive as when the program was started whenever a SEGMENT is called. 

Page 75 



Othertitise the su'^tem mill attempt to retrieve and execute whatever information 
curreTitly resides on that particular location ob the disk. 

SEGi'lLNT procedures must be the first procedure declarations containing code- 
generating statements. Declarations o^^ SEGllENT procedures and functions in 
UCSD Pascal are identical to those m standard Pascal, except th^it they are 
preceded bg the reserved luord "S'EGflEHT '„ 

As an example, mhon tne user wishes to put initialization procedures into a 
segment because they are one-time-only procedures.- the declaration mif^ht be: 

seghehi procedure initialize, 
b[(.;j:h 

<P Pascal code n) 
END, 

The Linker program thjt can link separately compiled SEGMENTS together is 
described m Set:tiOT! 2.9. 

3., 4 LlNKAGEl^ 

Freguently used routines and data structures can be separately compiled or 
assembled and can be stored in libraries until needed (see Section A. A.. 
Librarian) „ These externally compiled structures then can be integrated 
into the files needing their capabilities. A file that references such a 
structure need not compile it directly into its code file; the Linker copies 
the existing code of the strucbure into the host code file (sec Section 2,9, 
Linkfr). 



•age 



the INTERFACE part of the UHI'I as though that part belonped to the host 
program itself- Because the constants* types* variables* funrtions and 
procedures declared in the INTERFACE part are global* name conflicts may arise 
luith identifiers in the host program. The programmer may not use identifiers 
that are in use by the UNIT. Procedures and functions may not Use UHDs 
locally. 

The syntax for a UNIT definition is shoiun in Figure 3--A., The declarations of 
routine headings in the INTERFACE part sre similar to forward declarations; 
therefore* u>hen the corresponding routines are defined in the II'IPL.ENENTATIOH 
part* formal parameter specifications are not repeated. 

A UNIT may use another UNIT* as shotun in the example in Figure 3-5., In thit. 
case* the USES declaration must appear at the beginning of the INTERFACE 
part. 

NOTE: Variables of type FILE must be declared in th<> 
INTERFACE part of a UNITO. A FILE declared in 
the inPLEflENTATION part utill cause a syntax error 
at compile time. 

A user may define a UNIT in-line* after the heading of the host program. In 
this case* the user compiles both the UNIT and the host program together. 
Subsequent changes in either require a recompilation of both. 



Page 77 



(Compilation unit) 



(Program heading); <Unit def-initioTn); 

(Uses part) (BlocN) : 

< Jnit definition); <Unit definition )r 



<Unit definition) 



< Unit heading); 

< Interface part) 

< Imp lementa t-ion part ) 
End 



<Unit heading) 



(Unit identifier) 



- Unit (Unit identifier) : 
Separate unit (Unit identifier) 

- ( Identifier ) 



(Interface part) 



(Implementation psrt) 



(U!ies part) 



Interface 

( Jses part ) 

(Constant definition part) 

(Type definition part) 

(v'ariable declaration part) 

(Procedure headincj) : (Function heading) 

Implementation 

(Label declaration part) 

(Constant definition part) 

(Type definition part) 

(s^ariable declaration part) 

(Procedure and Function declaration part) 

Uses (Unit identifier) 
, (Unit identifier); : (Empty) 



Fi.Qure 3-A. SYNTAX FOR A UNIT DEFINITION 



A UNIT or group of UNIT& can be compiled separately and stored in a library. 
After compiling a host program that uses a UNIT that is stored in a library, 
the user must link that UNIT into the host program by executing the Linker- 
If a user calls R(un and an unlinked code file has been requested* the Linker 
will be called automatically- If X(ecute is called in such a case, the system 
will issue a reminder to imk the code (see Section 2.2. Outer Level Commands), 

If the host program has changes, the user must recompile and link in the UNIT. 
If the ItlPLEHENTATIOH part is changed, the UNIT must be recompiled, and then 
all compilation units that use the UNIT must be relinked. Changes in the 
INTERFACE part require a recompilation of not only the UNIT, but of all 
compilation units that use it. Then, all compilation units musb be relinked. 

The Compiler generates Linker information in the contiguous blocks that 
Follotti a program that uses UNITs. This information includes locations of 
references to externally defined identifiers (see Section 2.y, Linker). 

Page 7B 



3.^5 LONG INTEGERS 

is suitable for business* scientific or other applications luhere there is a 
need for extended number length u)ith complete accuracy. The Four basic 
standard arithmetic operations (addition* subtraction* multiplicfltion and 
division) are supported, as mell as routines facilitating conversion to 
strings and standard INTEGERS. Strong type checking is enforced to reduce 
potential errors. I/O, in-line declaration of constants* and inclusion in 
structured types are fully supported and are analogous to the usage of 
standard INTEGERS. 

LONG INTEGERS are declared by using the standard identifier "INTEGER" folloujed 
by a length attribute enclosed in square brackets. The length is given as an 
unsigned number* not larger than 36* that denotes the minimum number of 
decimal digits to be represented. In the example beloui* the variable Z is 
capable of storing up to a 12~decimal digit signed number: 

VAR Z: INrEGERri23i 

LONG INTEGERS may be used* generally, anyiuhere a REAL mould be syvitatically 
correct. However, care must be taken to ensure that sufficient words have? 
been allocated by the declared length attribute for storage of the result of 
assignment or arithmetic expression statements. INTEGER expressions are 
implicitly converted as required upon assignment to* or arithmetic operations 
luitti, a LONG INTEGER. 

Homever, the reverse is not true. The LONG INTEGER probably should not be 
used as a subrange. Examples of uses of the LONG INTEGER are shown in Figure 



Arithmetic operations that may be used in conjunction tuith the LONG INTEGER 
are.': 

+, ~* «* DIV* unary plus/minus 

On assignment* the length of the LONG INTEGER is adjusted during execution to 
the declared length attribute of the variable. Iherefore* an interrupt 
(overflom) may result when the intermediate result exceeds the number of words 
required to store at least 37 decimal digits* or when the final result is 
assigned to a variable with an insufficient length attribute. All of the 
standard relational operators may be used with mixed INTEGER and LONG INTEGER^ 

The function TRUNC will accept a LONG INTEGER as well as a REAL as an 
argument. The function becomes TRUNC<L)* where "L" is a LONG INTEGER. 
Interrupt (overflow) will result if "L" is greater than HAXINT. 

The procedure STR(L*S) will convert the INTEGER or LONG INTEGER "L" into a 
string, complete with minus sign if needed, and will place it in tht? STRING 
"S". 

An attempt to declare a LONG INTEGER in a parameter list other than for the 
routines TRUNC and STR will result in a compile- time error. The error may be 

Page 79 



rircumvented by creatinp rj type that is called LCHG INTECEW^ as fol'i.oiiis 



PROGRAr I. INTEGER, 
MAR L : INTEGIIRI20:], 

I ; IHTEGl-R, 
BE.GTH <!a.INTi:GERtf) 

1 - 9l}/&5^3210, 

!.. ; - •!., 

I.. - i. --L, 

i - .^>6i 

I fl;UNC(L), 

{,MD (fcLIHTEGERK). 

TYi'E LONG - INTEGER 15 

PROCEDURE OVER S I ZE< ACCOUNT; LONG) 



fxQure 3-S. EXAHPLE USES OF LONG INTEGERS 

The LONG INTEGER is stored as a multi-word> tiuos-compleme-nt binary number. 
SyBtpm routines do the I/O conversions as required, I'Ictximum storaqe 
efficiency is achieved by dynamic expansion and contraction of utord allocation 
35 required- During LONG INTEGER operations^ the len.gth is placed on the 
-jtack above the number itself « Note that the declared length attribute may be 
equal to or less than this lenqth„ 

3„6 UCSD PASCAL ENHANCEnENTB 

Presented here is a summary of tht ,jreas m which UCSD Pascal differs from 
Standard Pascal as luell as special enhancements offered by UCSD Pascal., The 
Standard Pascal referred to here is defined in PASCAL USER tIANUAL AND REPORT 
(2nd edition) by Kathleen Jensen and Nik laus Wirth (Sprinper-Verlaq.- 19713). 
flany of the differences are in the areas of files and I/O. Some of the key 
differences from a programming standpoint are in EOF, EOLN- READ^ WRITE.- RESET 
and REWRITE. 

3„6. 1 Case Statements 

In Standard PascaL if no labe?l is equal to the value of the case statement 
selt^ctor. the result of the case statem(?nt is undefined (Jensen and Uirth). 

In UCSD Pascal, if no label matches the value of the case se lector > the next 
statement executed is the statement follouiing the case statement. An example 
is shown in Figure 3-8. Note that 3 semicolon is NOT permitted before the 
"END" of a case variant field declaration within a RECORD declaration. See 
Appendix B.2 for revised syntax diagrams for < field list). 



PROGRAn FA-LTHRU, 
VAK I : INTEGER; 

Page 80 



BKGIN (KFAI,l,THRU«) 
I := 25; 
CASE 1 OF 

: URITELMCI - OOi 

1 : WRITELHCI = iO, 
iEHD<RCASEii); 

WRITELNCHEUHER'); 
END <«FALLrHRU«). 



Fiyure 3-6, EXAilPlE OF FALLTHROUGH IN A CASE BTATEilf: Iff 
3« 6, 2 Cofflments 

A comment is any text that appt?ars betaieen the symbDi^ "U" and "fO" or the 
symbols "C" and ">", Comments are ignored by the Compiler unless the first 
character of a comment is "*", in tuhich case* the comment is interpreted to b(? 
a Compiler control comment (see Section 2.7, Pascal Compiler), Note that 
matching symbols must be used; they may not be mixed. This feature ailoms a 
user to nest comments. For example: 

t XCP := XCP + 1; (a NESTED COnHENT «) > 

The matching symbols have been used as pairs tyithin pairi> of different 
symbols. Using the same pair for nesting mill result in a synta.x error. 

3..'S.3 Dynamic Hemory Allocation 

In Standard PascaL DISPOSE asks that storage occupied by one particular 
variable be released by the system for other uses,, 

In UCSD Pascal, DISPOSE is not implemented. Hotuever, it can be approximated 
by a combined use of the intrinsics HARK and RELEASE. 

Storage is allocated for variables by the standard procedure NEW in a stack - 
like structure called a "heap". The program in Figure 3-9 illustrates hoia 
MARK and RELEASE can be used to change the size of the heap. As NEW is used 
to create a neu» variable, the size of the heap is augmented by the size of the 
variable. When the variable is no longer needed, RELEASE resets the top of- 
heap address that tuas set. originally by MARK. 

A series of calls to NEW betujeen calls to MARK and RELEASE will result m the 
immediate release of storage occupied by several variables at RELEASE time. 
Note that, due to the stack nature of the heap, it is not possible to release 
memory used by a single item in the middle of the heap. This is why HARK and 
RELASE only approximate the function of DISPOSE., 

Careless use of MARK and RELEASE can lead to "dangling pointers" that po.int to 
areas of memory that are no longer a part of the defined heap space. 

3.6.4 EOF(F) 

When text file F is being used as an input file from the CONSOLE device, to 

Page 81 



5Pt tOF to True, the user must type the EOF character. The system default EOF 
character is control-C. (To change the default character, see Section -^^ !■ 
Sett «p . ) 

If F is closed, EOF(F) will return True for any FILE F, If F is a file of 

type TEXT and EOF(F) is True, ther EOLN(F) is also True, After a R£StT<F), 

EOF<F> is False. If EOF(F) becomes True <end-of-file is reached) during a 
GET(F) or READ(F), the dr3ta obtained is invalid. 



PROGRftn HFAPtWG; 
TYPE S7UDENI - 

NAI1F PACKED ARRAY fO-.lOJ OF CHAR.; 
ID INTFGER 

VAR S ; ^STUDENT; <« ■'■^' MEANS POINTER «) 
HEAP : -^INTEGER; 

BEGIN (KHEAPCHNGK) 

HARK ( HEAP )i 

NEU(5); 

S^.NAHE - 'SriITH, JOHN'i 

S-^.ID :- 265A, 

RELEASE ( HEAP ) , 
END (KHEAPCHNGK). 



Figure 3-7. USING HARK AND RELEASE TO CHANGE HEAP SIZK 

When a user program starts execution, the system automatically performs a 
RESEI on the predeclared files INPUT, OUTPUT and KEYBOARD. 

The default file for EOF and EOLH is IMPIJT,. 

3.6.r> EOLN(F) 

EOLN<F) is defined only if F is a text file. F is defined as a text file 
lohen the luindouf variable F-^ is of <type>CHAR. EOLN becomes True after 
reading the end-of-line character <cr>. The carriage return must be typed 
immediately following the last character on the line. If a space is typed 
First, ttien folloiued by a <cr>, EOLN will remain False, and another READ mill 
take place,. 

3.6.6 Files 

Several aspects of file handling are described below. Ihr enhancements 
presented bring UCSD Pascal closer to the standard definition of the language. 
Note that UCSD Pascal includes untyped files that are not available to the 
Standard Pascal user. 

WARNING: It is not currently possible to READ or WRITE to files of types 

Pace 02 



other than TEXT or FILE OF CHAR, 
Interactive Files 

The standard predeclared files INPUT and OUTPUT will always be defined 
as type INTERACTIVE. They behave exactly ay do files of type TEXT. 
All files other than INTERACTIVE operate exactly as described in Jensen 
and Wirth, including the functioning of EOF<F), EOLN(F) and RESET<F). 
For more details concerning files of tupe INTERACTIVE^ see Section 2.6 
(READ. READLN and RESET), 

Untyped Files 

Untyped files are unique to UC8D Pascals An untyped file can be 
thought of as a file ujithout a utindotu variable F*^ to which all I/O 
must be accomplished (using BLOCKREAD and BLOCKWRITE). Any number 
of blocks can be transferred using either BLOCKREAD or BLOCKWRITE, 
These functions mill return the actual number of blocks read/ujritten. 
When untyped files are used, it is advisable to specify the Compile 
option "I", thus requiring that the function lOREBULT and the number 
of blocks transferred will be checked after each BLOCKREAD or BLOCK- 
WRITE to detect any I/O errors. An example of a program that uses 
untyped files is shoum in Figure 3-8,. 

Random Access of Files 

Individual records in a file can be accessed randomly by the intrinsic 
SEEK« The tu)o parameters for SEEK are the file identifier and an 
integer giving the record number to which the windoun should be moved^ 
The first record of a structured file has the number 0, BEEK always 
sets EOF and EOLN to False. The subsequent GET or PUT will set these 
conditions as appropriate. Attempts to PUT records beyond the physical 
end of file will set EOF to True. 



(K*I-K) 

PROGRAil FILEXAMP; 
VAR S,D : FILE; 

BUF : PACKED /srf^RAYrO. ,5113 OF CHARi 
BLKN, BLKS'iRAN : INTEGER; 
lOERR : BOOLEAN; 
BEGIN (KFILEXAi'lPH); 
It€RR :=^ FALSE; 
RESET(S, 'FROfLDATA'); 
REWRITE (D, 'TO'); 
BLKN — 0; 

BLKSTRAN ; ■^- BLOCKREAD (S, BUF, L BLKN) ; 
WHILE (NOT EOF(S)) AND (lORESULT =•• 0) 

AND (NOT lOERR) AND (BLKSTRAN-^1) DO 
BEGIN 
BLKSTRAN := BLOCKWRirE(D, BUF, 1, BLKN); 
lOERR := ((BLKSTRAN ( 1) OR (lORESULT <> 0)); 
BLKN := BLKN + 1; 

Page B3 



Bl>:STKAH :== BLOCKRLHD(S,eUF, 1, BLKN) , 

CLOSE <D, LUCK); 
END <(«FILEXAt1P«) . 



FxQure 3 -B. EXAHPLE OF USING UNIYPED FILES 

3.6.7 GOTO and EXIT Stfltemctitn 

The GOTO statement prohibit'-, c> GCIO to a label that is not luithin the same 
block as the statement. This is a limitation that is not imposed on the GOTO 
statement in Standard Pascal. Because of= this limitation, the examples on 
pages 31-32 of Jensen and Uirth do net apply. 

EXIT is a UCBD extension statement. Its only parameter is the identifier 
of the procedure to be e:<ited. The EXIf statement mas created because of 
the occasional need for a means tc abort a complicated, and possible deeply 
nested, series of procedure calls upcn encountering an error. The recursive 
descent UCSU Pascal Compiler contains an example of the EXIT statement beina 
used in this u>ay. However, the use cf this statement is discouraged. 

NOTE: The use of an EXIT statement to exit a function 
can result m the function returning undefined 
values if no assignment is made to the function 
identifier prior to the execution of the EXIT 
statement. 

If the identifier in the EXIT statemt-nt is that of a recursive procedure, the 
most recent invocation of that frocedure u»ill be exited. Upon EXIT, an 
implicit CLOSE<F) is don© on local files that were opened during execution 
of the procedure being exited. Ar^ example of using EXIT is shouin in Figure 

3-9. 



3.6.8 Packed Variables 

Described beloui are packed arrays and records, using packed variables as 
parameters, and (not) using PACK and UNPACK. 



PROGRAM EXITTESTi 
VAR 3 ; STRING; 



I : INTEGER; 



PROCEDURE CALL, FORWARD; 

PROCEDURE PR [NT; 
BLGIH (»PRIHTK) 
UKI J ELHi -->'); 
l!EADLN(3); 
|JRITELN<S) 

P ige BA 



IF 8113 = '^' THEW EXIT (CALL); 
URITELN( 'LEAVE PRINT'); 
END <»PRINT«); 

PROCEDURE CALL; 
8ECIN <»CALLi^) 

PRINT; 

WRITELN CLEAVE CALL'); 
END (CALLK); 

PROCEDURE COUNT; 
BECIN (KCOUNTK) 
IF I <^^ 10 THEN CALL; 
UR I TELN CLEAVE COUNT'), 
END («COUHTK). 

BECIN (KEXITIESTH) 
I :- 0; 

WHILE NOT EOF DO 
BEGIN 
I :^- IH, 
COUNT; 
WRITELN; 
END (KUHILE«); 
END (KEXITTESTK). 



Figure 3-9. EXAMPLE OF USING THE EXIT SIATEHENT 
Packed Arrays 

The UCSD Pascal Compiler luill pack arrays if the ARRAY dwiaration 
is preceded by the utord PACKED. For e.<ample: 

ARRAYr0..93 OF CHAR; 
PACKED ARRAYrO,.93 OF CHAR; 

The array in the first declaration unill occupy ten 16-bit luords of 
memory, with each element occupying one word. The &vva\i m the 
second declaration utill be packed into a total of five unords. since 
each 16'bit word contains two 8-bit characters. Thus each element 
is eiciht bits lon_g» 

Examples of packed arrays that are not of type CHAR ctre given m 
Figure 3-10- 

Due to the recursive nature of the Compiler, the following two 
declarations are not equivalent. 

PACKED ARRAYrO».9:j OF ARRAY10.,.3D OF CHAR; 
PACKED ARRAYrO,.9,0-.3J OF CHAR; 

In the first declaration, the second ocurrence of ARRAY causes the 

Page B5 



packiny option in the Compiler to be turned off, ijivi^'fl ^t^ unpDckBd 
array of AO luords. The array in the second declaration occupies a 
total of 20 iBords beCcU'se ARRAY appears only once. If the second 
occurrence of ARRAY in the --irst declaration had also been preceded 
by PACKED, the tioo declarations ujould have been equivalent. 



PKOCRAn PACKTBT; 



VAR A 

C 



Hf-RIN 



PACKED ARRAY TO. -9] OF 0.,2000; 
PACKFD ARRAY TO. .15'J OF BOOLF.ANi 
PACKL-D RFCORU 

D: BOOLEAN, 

CASF E: BOOLEAN OF 

TRUF: (F; INTEGER), 

FALSE: 'G PACKED ARRAY rO,.7J OF CHAR) 



Figure 3-10. £XmPlE3 OF PACKED ARRAYS AND RECORDS 

An array mill be packed only if the final type of array is scaler, 

subrange, or a set that :an be represented in eight bits or less or 

if the final type is BOOLEAM or CHAR. Mo packin.g is done if the 
array cannot be expressed in a field of eight bits. 

No packing occurs across word boundaries. IF the type of element to 
be packed requires a number of bits that does not divide evenly by 
16, unused bits (uill be at the high end of each of the tuords that 
comprise the array. 

NOTE: It is illegal to assign a string constant to an unpacked 
ARRAY OF CHAR, altfiough it may be assigned to a PACKED ARRAY CF 
CHAR. Also, comparisons between an ARRAY OF CHAR and a string 
constant are illegal. This is because of size differences. 

A PACKED ARRAY OF CHAR may be output luith a single WRITE statement, 
and may be initialized by using the intrinsics FILLCHAR and SIZfcOF. 



Packed Records 



As luith arrays, the Compiler mill pack records if tha RECORD 
declaration is preceded by PACKED. In the example belouj, the entire 
record is packed into one 16bit word. 

yAR A; PACKED RECORD 
«S»,R,S: 0..31i 
B: BOOLEAN 
END; 



Page 86 



The variables Q, R and S each take up five bits„ The boolean variable 
is allocated to the sixteenth bit. 

PACKED RECORDS may contain fields that also are packed, either arrays 
or records. But PACKED roust occur before every occurrence of RL'CORD to 
retain packed qualities throughout all fields of the record. 

A case variant may be used as the last field of a PACKED RECORD, The 
amount of space allocated to it tuill be the size of the larcjest variant 
among the cases. 

Using Packed Variables as Parameters 

Packed variables may be passed as call-by-value parameters to a pro- 
cedure or function. However, they may not be passed as call-by- 
reference parameters. 

PACK and UNPACK 

UCSD Pascal does NOT support the standard procedures PACK and UNPAf'K. 
(Jensen and Wirth, 106). 

3.6.9 Parametric Procedures and Functions 

UCSD Pascal does NOT support the use of procedures and functions as formal 
parameters in the parameter list of a procedure or function. 

3.6.10 Program Headings 

A list of file parameters may folloiu the file identifier. However, they are 
IGNORED by the Compiler and have no effect on the program being compiled. 
Any file declarations other than the three predeclared files (INPUT, OUTPUT 
and KEYBOARD) of type INTERACTIVE must be declared along with the other MAR 
declarations for the program. 

3.6.11 READ and READLN 

In Standard Pascal, the procedure READ requires that the window variable 
F'^ be loaded with the first character of the file when the file is opened. 
If effect, the statement READ(F,CH) would be equivalent to: 

CH: =F^; 
GET(F)i 

To be responsive to the demands of an interactive programming environment, 
UCSD Pascal defines the additional file type INTERACTIVE. Declaring a file to 
be of type INTERACTIVE is equivalent to declaring it to be type TFXT, except 
that the definition of READ(F,CH) is reversed: 

GET(F)i 
CH: ^F-^; 



Page 87 



The standard definition of the procedure READ requires tha the process of 
openiny a file include loadincj the tuindou) variable F'^ with the first 
character of the file. In an interactive environment it is inconvenient to 
require a user to type a character of the input file «>hen it is open to avoid 
the proyram "hanging" u>hen it is first opened, (o overcome this> UCSO Pascal 
has reversed the order. This difference affects the u»ay in mhich tOLH must be 
used tuhen reading from a text file cf the type interactive. EOLN only becomes 
true after reading the end of line character, a <return>,. The character 
returned as a result of the l<EAD is a blank. 

Three predeclared text files (INPUT, OUTPUT and KEYBOARD) of type INTER- 
ACTIVE are opened automatically for a user program. The file INPUT defaults 
to the console device. The statement R£AD( INPUT, CH) , luhere CH is a character 
variable, mill echo the character typed from the console back to the console. 
WRITE statements bo the file CU i PUT luill cause the output to appear on the 
console, by default. The file KEYBOARD is the non-echoing equivalent to 
INPUT. For example.- the follfmung tuto statements are equivalent to 
READ( INPUT, CH 

READ (KEYBOARD, CH) , 

URIiE (OUIPUT, CH), 

3.A.12 RESET (F) 

In Standard Pascal, the procedure RESET resets the file tuindoro to the 
be.ginning of file F, Ihe next GLT'F) or PUT(F) affects record of the file. 
Also, the windotB variable F-'^ is loaded with the first record of the file. 

In UCSD Pascal, the standard cnnveitions hold true unless the fik? is of type 
INTERACTIVE. In that case, the wmiou) variable is WOT loaded. Thus, the UCSD 
equivalent of the Standard RESET(F) is the tiuo-statement sequence; 

RESET (F), 
GET(F); 

UCSD Pascal also provides an alternative form of opening a pre-existing file. 
In it, RESET has tuio parameters; the file identifier folloa>ed by either a 
string constant or variable, tuhichever corresponds to the directory file name 
of the file being reopened. 

3.6A3 RE.URITE(F) 

REWRITE opens and creates a new file. It has ttt>o parameters; the file 
identifier followed by either a string constant or variable, whichever 
corresponds to the directory file name of the file being created. 

REWRITE performs the same as the UCSD intrinsic OPENKEW, and u)ill replace it 
eventually (see Section 3.1, Intrirsics). 

'3.,6..XA Segment Procedures 

The SECHENT PROCEDURE is a UCSD extension to Pascal. With it, the programmer 

Page UB 



can segment a larjse program so that the entire program does not have to be in 
memory at once. For further information, see Section 3.3, Se.gmenb«>- 

3;, 6^ 15 Bets 



All of the Standard Pascal constructs for sets are supported by UCSD Pascal 
<see p. 50-51 of Jensen and Uirth). Sets of enumeration values are limited to 
positive integers only. Also, a set is limited to 255 mords and 40e0 
elements. Comparisons and operations are allotted only between seti> that are 
either of the same base type or subranges of the same underlying type. 
Examples are shown in Figure 3-11, 



PROGRAM SETSTj 
VAR SET.t: SET OF 0..49; 
8FT2: SET OF 0.,99^ 

BEGIN («SFTSTK) 
5ET1 ;- 10,5,10.1; 
SET2 :- no, 20, 303; 
IF SETl --'• SET2 THEN 

WRITELW<'THEY ARE EOUAL') 
ELSE 

URITELWCTHEY ARE NOT EQUAL'); 
END(KSET5T«). 

Sets of different underlying types cannot be compared: 

PROGRAil SETCOnP; 
TYPE INGREDIENTS = (FLOUR, SUGAR, EGGS, SALT); 

MAR I; SET OF INGREDIENTS; 
N: SET OF 0..49; 

BEGIN (KSETCOnPK) 

I :== TFLOURD; 

H := 11,2,3,4,53; 

IF I =-- N THEN < ERROR WILL OCCUR HERE 

URITELN<'E«JUAL'); 
END (KSETCOHPK). 



Figure 3-11. EXAHPLES OF SET COMPARISONS 
3«6A6 Strings 

STRING variables are unique to UCSD Pascal. Essentially, they are PACKED 
ARRAYS of CHAR with a dynamic LENGTH attribute, the value of which is returned 
by the string intrinsic LENGTH. The default maximum length of a string 
variable is 80 characters. This value can be overridden in the declaration of 
a string by appending the desired length within 13 after the type iden- tifier 

Page 89 



STRING. For further information and examplesi see Section 3.1-.1» String 
Intrinsic5. 

A string variable has an absolute maximum length of 255 characters- Assign- 
ment to string variables can be performed using the assignment statement* UCSD 
string intrinsics, or luith a READ statement. For example: 

TITLE: =' THIS IS HY STRING '; 

REA[)LN(nYSTRING)i 

NAriE:= C0PY<nYSTRING,l,21), 

The individual characters within a string are indexed from 1 to the length of 
the string. A string variable may rot be indexed beyond its current dynamic 
length. 

String variables may be compared to other string variables* no matter what the 
current dynamic length of either. Thf lengths do not have to be equal. 

One of the most common uses of string variables in UCSD Pascal is reading file 
names from the console device. When a string variable is used as a parameter 
to READ or READLN* all characters up to the end-of-line character (carriage 
return) in the source file u»ill be assigned to the string variable. In reading 
string variables* the single statement READLN<S1*S2) is equivalent to the tujo- 
statement sequence: 

READ<Sl)i 
RFADLN<S2)i 

3.6.17 WRITE and WRITELN 

The procedures WRITE and WRITELN foilaiu the conventions of Standard Pascal 

except u»hen applied to a variabL? of type BOOLEAN. UCSD Pascal does not 

support the output of the ujords TRUE or FALSE vuhen writing out the value of a 
boolean variable. 

For writing variables of type STRING, see Section 3.1.1* String Intrinsics. 
When a string variable is written without specifying a field width* the actual 
number of characters written is equal to the dynamic length of the string. If 
the field width specified is longer than the dynamic length* leading blanks 
are inserted. If the field width is smaller* excess characters will be 
truncated on the right. 

3.6.18 Implementation Size Limits 

The maximum size limitation of UCSD Pascal are: 

1. Maximum number of bytes of object code in a procedure or function 
is 1200. Maximum number of words for local variables in a 
procedure or function is 16383. 

2. Maximum number of characters in a string variable is 255. 
3- Maximum numb€»r of elements in a set is 255 k 16 = ^080. 



3 age 90 



^. Haximum number of segment procedures and functions is 16* of 
which nine are reserved for the Pascal system and stwen are 
available to the user, 

5. Maximum number of procedures or functions luithin a segment is 12/. 
3,6.1V Extended Comparisons 

UCSD' Pascal permits - and < > comparisons of any array or record structure. 



Page 91 



SECTIOW A 

UTILITIES 

4, 1 SETUP 

Certain information about the user's system configuration is kept in a file 
called SYSTEH.IIISCINFO. During system initialization* this file is read into 
memory. From there* it is accessed by many parts of the Pascal Operating 
System* particularly* where applicable* by the Screen-Oriented Editor. 

Hurh of the information in this file must be set up by the user to conform to 
his hardware configuration and particular needs. Most concerns the nature of 
the terminal and keyboard* although there is some miscellaneous information. 

SETUP is run by typing "X" for eX(ecute at the Outer Level of commands* then 
the file name SETUP* followed by a carriage return. The following prompt line 
appears: 

SETUP: C(HANGE T<EACH) H(ELP) Q(UIT) 

The program is self-teaching. Typing "H" for H(ELP) will produce an 
explanation of what the other commands do. If the SETUP program is not on the 
disk, the following message will appear: 

no file setup. CODE 

SETUP does not tell the system how to do random cursor addressing on the 
user's terminal. If this feature is part of the user's hardware 
configuration* information on using the feature can be found in Section 4.V* 
GOTOXY Procedure Binder. 

AAA Miscellaneous Information 

HAS S510A 

If TRUE, the system is running on a Terak 0510A hardware 
configuration; otherwise FALSE. 

HAS CLOCK 

If TRUE* a real-time clock is available* otherwise FALSE. The real- 
time clock module is assumed to be a line frequency clock. Uhen 
available* the clock is used by the system to optimize disk directory 
updates (see Section 3.1.6. Time Intrinsics). 

4.1.2 General Terminal Information 

HAS LOWER CASE 

If TRUE* the terminal has lower case* otherwise FALSE. 

HAS RANDOM CURSOR ADDRESSING 



Page 93 



If TRUE, the terminal has random cursor addressing; otherujise FALSE- 
This applies only to video terminals. 



HAS SLOW TEROIhlAL 



If TRUE/ the terminal has a baud rate of 600 or less; otherwise FALSE. 
When TRUE* the system issues abbreviated prompt lines and roessapes. 



NON -PRINTING CHARACTER 



Any printing character may be entered here to indicate the character 
that should be displayed to indicate the presence of a non-printinp 
character. The suggested character is ASCII "?". 



SCREEN HEIGHT 



Enter the number of lines disolayed on the screen of a video terminal. 
Otherwise* enter for hard-copy terminal or one in which paging is 
not appropriate. 

VERTICAL HOVE DELAY 

Enter the number of nulls to send after a vertical cursor move. The 
nulls will be sent after a carriage return. ERASE TO END OF LINE. 
ERASE TO END OF SCREEN and HOVE CURSOR UP. Many types of terminals 
require a delay after certain cursor movements to enable the terminal 
to complete the movement before the next character is sent. 

4.1.3 Control Key Information 

Some keyboards generate two codes when a single key is typed. That is 
indicated according to the following format: 

PREFIXEDr<fieldname>3 TRUE 

The prefix for all such keys must be the same. For example, many keys 
function as escape keys in addition to their named function. If a user's 
keyboard had a vector pad that generated the value pairs ESC "U" and ESC "D" 
for the Uparrow and Dowriiarrow keysj respectively, the following values should 
be entered: 

KEY FOR MOVING CURSOR UP ASCII "U" 

KEY FOR mVING CURSOR DOWN ASCII "D" 

LEAD-IN KEY FOR KEYBOARD ESC 

PREFIXEDfKKEY FOR MOVING CURSOR UP 3 TRUE 

PREFIXEDfKEY FOR MOVING CURSOR DOWND TRUE 

The following keys may apply to all terminals. 

KEY FOR BREAK 

Tiping the BREAK key causes the program currently executing to be 
terminated immediately with a runtime error. This should be set to 
something that is difficult to hit accidentally. 

Page 9 A 



KEY TO DELETE CHARACTER 

This key removes one character from the current line. It may be typed 
until nothing is left on the line. The suggested setting is ASCII BS. 

KEY TO DELETE LINE 

This key ujill cause the current line of input to be erased. The 
suggested setting is ASCII DEL. 

KEY TO END FILE 

This is the console end~of-file character that sets the boolean 
function EOF to True. This applies only to INPUT or KEYBOARD files or 
the unit CONSOLE. The suggested setting is ASCII ETX. 

KEY FOR FLUSH 

This is the console output cancel character. When the FLUSH key is 
pressed> output to the file OUTPUT is undisplayed until FLUSH is 
pressed again or the system writes to the file KEYBOARD. Processing 
is uninterrupted even though the output is not displayed. The 
suggested setting is something that is difficult to hit accidentally- 

KEY FOR STOP 

This is the console output stop character. When preseed/ output to 
the file OUTPUT ceases. Output resumes uthere it left off when the key 
is pressed again. This function is useful for reading data that is 
being displayed t-oo fast for easy reading. The suggested setting is 
ASCII DCS. 

The following keys are applicable only to video terminals that have selective 

EDITOR "ACCEPT" KEY 

In the Screen-Oriented Editor* this key is used to accept commands* 
thus making permanent any action taken. The suggested setting is 
ASCII ETX. 

EDITOR "ESCAPE" KEY 

In the Screen-Oriented Editor* this key is used to escape from 
commands* reversing any action taken. The suggested setting is ASCII 
ESC. 

KEY TO HOVE CURSOR UP 

DOWN 
LEFT 
RIGHT 

These keys are used by the Screen -Oriented Editor for cursor control. 

Page 95 



If the keyboard has a vector pad, the keys must be set to the value it 
generates. (3thenuise, four keys may be chosen in the pattern of a 
vector pad (e.g., "0", ".", "k" and ";") and be assigned the control 
codes that correspond to them. A prefix character may also be used. 

^,l.A Video Screen Control Characters 

The video screen control characters are sent by the computer to the terminal 

to control the actions of the terminal. The terminal manual luill give the 

appropriate values. If a terminal does not have one of these characters, the 
field should be set to 0, unless otherwise directed. 

On some terminals, a ttBo-character sequence is required for some functions 
(e„q. , CBC plus a character). If the first character for all of the functions 
is the same, it can be set as the value of the field LEAD-IN TO SCREEN. Then 
the field PREFIXr< fieldname)] must be set to TRUE for each two-character 
function. 

BACKSPACE 

This character causes the curiior to move one space to the left. 

ERASE LINE 

This character causes the er.isure of all characters on the line where 
the cursor is currently located. The cursor is relocated to the 
beginning of the line. 

ERASE SCREEN 

This character erases the entire screen. The cursor is repositioned 
in the upper left hand corner of the screen. 

ERASE TO END OF LINE 

This character causes the erasure of all characters from the current 
position of the cursor to the end of the line. The cursor location is 
unchanged. 

ERASE TO END OF SCREEN 

This character causes the erasure of all characbers from the current 
position of the cursor to the end of the screen. The cursor location 
is unchanged. 

HOVE CURSOR HOilE 

This character causes the cursor to be relocated to "home", which is 
the upper left hand corner of the screen. 

NOTE: If the terminal does nat have such a character, the field 
should be set to ASCII ZR (carriage return). 

rtOVt CURSOR UP 

Page 96 



These characters cause the cursor to move rton-destructively one space 
in the direction indicated. 

A.?. BOOTSTRAP COPIER 

The bootstrap copier uirites the first two blocks of the specified file to the 
specified unit. This utility is on the file BOOTER.CODE. It is run by typing 
"X" for BX(ecute at the Outer Level of commands, folloujed by BOOTER- A prompt 
line appears to ask for the unit number of the volume on which to write the 
bootstrap. 

Following the entry of the unit number <see Appendix Q.A), the file name to 
write as the bootstrap will be asked for. 

To copy the bootstrap from an existing disk, give the disk name. Then the 
bootstrap will be copied from the disk named to the unit numbered. 

4.3 DUPLICATE DIRECTORY UTILITIES 

These are two utilities to handle duplicate directories. COPYDUPDIR copies 
the duplicate directory, and tIARKDUPDIR marks a disk that currently is not 
maintaining a duplicate directory. They are described below. 

COPYDUPDIR 

This program copies the duplicate directory into the primary directory 
location. It is entered by typing "X" for eX(ecute while in the Outer 
Level of commands, followed by COPYDUPDIR. The program then prompts 
for the drive (-'l or 5) in which the copy is to take place. 

If the disk is not currently maintaining a current directory, a 
message is generated. 

If no duplicate directory is found after the drive number has been 
entered, a message is generated. 

If a duplicate directory is found, then a prompt will ask if the 
directory currently in blocks 2-5 is to be destroyed. 

A "Y" answer will cause the execution of the copy. Any other answer 
will abort the program. 

If the disk is nob currently maintaining a current directory, the 
RECOVER program should be run. This is described 

harkdupdir 

This program will mark a disk that is currently not maintaining a 
duplicate directory. It is entered by typing "X" for eX<ecute while 
in the Outer Level of commands, followed by HARKDUPDIR. The program 
will prompt to get the unit <4 or 5) that is to be marked. 



Page 97 



Blocks 6-9 must be free. The program u)ill check for this and uiiil 
give the following message if the blocks appear to be in use: 

A "Y" response, indicating that the user is sure 
that the blocks are free, mill execute the mark. 
Any other character mill abort the program. 

Blocks 6-9 can be checked bu using the ECxtended command in the File 
Handler. The extended listintj mill shorn where the first file starts. 
If the first file starts at block 6, or it if starts at block 10 but 
there is a four-block unused section at the top, then the disk has not 
been marked. However, if the first file starts at block 10 and these 
are no unused blocks at the beginning, the disk has been marked. 

In the examples below, the dUMs have not been marked. 



SYSTEM. PASCAL 


31 


lO-Jan-79 


6 


Codef i le 


unused 


4 


lO-Jan-79 


6 


Codef i le 


SYSTEM. PASCAL 


31 


lO-Jan-79 


10 


Codef i le 



Below is the directory of a properly marked disk. 

SYSTEM. PASCAL 31 lO-Jan-79 10 Codef ile 

4.4 LIBRARIAN 

The librarian allows the user to link separately compiled Pascal units and 
separately assembled subroutines into a library file. The librarian is 
entered by typing "X" for eX(ecute while in the Outer Level of commands, 
followed by LIBRARY. 

Before adding a segment to the KSYSTEil. LIBRARY, the user must create a new 
file into which each segment that is wanted from the original kSYSTEM. LIBRARY 
is linked. Then it is possible to add segments by linking from another code 
file into the new file being created. 

On entering the librarian program, tha user is prompted for the name of the 
output code file: 

Output Code File -> 

The program then prompts: 

Link Code File -> 

to which the user should respond with «SYSTEn. LIBRARY. Then the program 
displays the names of all segments currently linked into the input library, as 
well as their length in bytes. A maximum of 16 segments are permitted in any 
Pascal program or library. After the program lists the segments, it prompts: 

Segment « to link and <^ace>, N<ew file, Q<uit, A<bDrt 

The user responds with the number of the segment within the link code file 

3a ge 98 



that is to be linked into the neiu library file* folloiBed by < space). Next* 
the UBer enters the number of the segment in the output file to be linked into 
(i.e.* the neiu library)* folloiued by a < space). For each segment linked* the 
program reads the segment from the input file and writes it to the output file 
at the segment requested. It then displays the segments currently in the 
output library. 

When all needed segments have been linked* a new input file is requested by 
typing "N" for N(eu). Once the needed segments from all input files have been 
linked* the user locks the output file by typing "Q" for Q<uit» followed by 
<cr). The linking process is aborted by typing "A" for A<bort„ In that case* 
control returns to the Outer Level of commands. 

The old KSYSTEil. LIBRARY should either be removed or have its name changed if 
it resides on the same disk as the new. The name of the new library should be 
changed to «SYSTEN. LIBRARY in order to be used. 

^.5 LIBRARY MAP 

The library map program produces a map of a library or code file and lists the 
linker information mantained for each segment of the file. It is entered by 
typing "X" for eX(ecute while in the Outer Level of commands* followed by 
LIBI1AP, The program will return with a prompt asking for a library file name. 

An asterisk <») will indicate «SYSTEri. LIBRARY, The ".CODE" suffix may be 
suppressed when requesting a library or file other than the RSYSTEM. LIBRARY by 
appending a period to the full file name. For example: 

tiping: will reference the file: 

K KSYSTEil. LIBRARY 

DIGITAL : DIGITAL. CODE 

DIG, LIBRARY. : DIG. LIBRARY 

The library map utility usually is used to list library definitions. However* 
when the program prompts for a reference list. 

typing a "Y" in response will cause the program to include intra-library 
symbol references, A negative response is indicated by tiding a < space) or 
<cr). Then the program prompts for an output file name. 

If the extra period at the end of the file name entered is not used* the 
program will automatically append ".TEXT". 

Several libraries may be mapped at the same time. Typing a <cr) when prompted 
for a file name will quit the program and return control to the Outer Level of 
commands. 

4.6 P-CODE DISASSEtlBLER 

The P-code disassembler inputs a UCSD code file and outputs symbolic pseudo- 
assembly code (P-code) along with statistics on opcode frequency* procedure 
calls and data segment references. The disassembler is helpful to the user in 
optimizing programs and provides a source of information on the subtleties of 

Page 99 



the UCSD iroplemeiitation of Pascal. All statistics gathered are static in that 
they are collected by making a pass through the code file rather than 
collecting them dynamically u^ile the code file is running, 

A. 6.x Disassembly 

The disassembler is invoked by typing "X" for eX(ecute while at the Outer 
Level of commands, foliouied by DISASM.IS. The file OPCODES- 15 must be on the 
system disk. On entering the disasseifibler, the first prompt is for an input 
code file: 

The suffix ".CODE" is assumed* and therefore is not required. The code file 
must be one that has been generated bu the Pascal Compiler. If a program USLB 
a UNIT, the disassembly program will include the UNIT only if the code file 
has been linked. Assembly language routines linked into a Pascal host will 
not be included in the disassembly. 

The next prompt asks if the first physical byte <byte 0) of a machine word is 
the most significant byte of the word. 

The next prompt is for an output file for the disassejobled output. Because 
the output file has not been defined by type, either CONSOLE: or PRINTER: <if 
on-line) may be used- 

Then the user must decide if he wishes to take control of the discissembly to 
disassemble only selected procedures rather than all of them in the file. 

If the user responds with a "Y", a message warns that all statistics are 
gathered only on the procedures that are disassembled. The Segment Guide then 
displays the segments in the file by name so that a particular segment can be 
selected. Then the Procedure Guide is listed when an "L" is typed to give the 
procedures contained in the segment (see Section 4.6.2 below for more 
details). 

The Segment Guide may be reentered by typing "Q" while in the Procedure Guide, 
enabling the user to disassemble several procedures in several segments on a 
selective basis. The Segment Guide is exited by typing "Q". Figure 4-1 gives 
an example of a Pascal program, its disassembly and its statistics. 



Pace 100 



.1 1 


I 1:D 


1 


<»«*L DISASSn.TEXTK) 


2 J 


I 1:D 


1 


PROGRAH DISASSII; 


3 J 


L 1:D 


3 




A i 


I 1:D 


3 


MAR J, I : INTEGER; 


5 3 


L 1:D 


5 


BUF : ARRAYr0..63 OF INTEGER; 


6 ] 


I 1:D 


12 




7 3 


L 1:0 





BEGIN 


8 ] 


L 1:1 





,J :--=^; 


9 i 


L 1:1 


5 


I :=J+li 


10 ] 


L 1:1 


10 


BUr-rJ3 :=200; 


11 3 


L 1:0 


22 


END, 



Sample Pascal Propram 



Sample Program Disassembled 



Fijjure A~l. DISASSEI1BLY EXAHPLE 



Page 101 



4.6.2 Data Segment Reference Statistics 

The roost common use of the references to data segments for a particular 
procedure is to optimize the procedure's code file. By rearranging the order 
of the declaration of variables* the offset for a given variable may be 
changed within the data S6?gment. The first 16 words of-fset into the data 
segment are the fastest and have optimized one-byte instructions. Offsets 
from 17 to 127 result in instructions at least two bytes long; greater than 
127> at least three bytes long. If the most frequently used variables have 
the smallest offsets, considerable code file space* and possible execution 
time* may be saved. 

The Procedure Guide listing gives all of the procedures in a selected segment 
by number, lex level and data segment size. Refering to the previous section, 
the listing is made in response to typing an "L" after the segment has been 
selected. 

4.6.3 Opcode, Procedure Call and Jump Statistics 

The opcode, procedure call and jump statistics are collected as an aid to 
optimizing the architecture of P-code. They are of little use to the pro- 
grammer. The last prompt of the program asks for the name of the file to 
which these statistics should be dumped. 

4.7 PATCH/DUIIP 

The patch/dump program is entered by typing "X" for eX(ecute while in the 
Outer Level of commands, followed by PATCH. On entering the program, the 
following prompt line appears: 

C(onsole, Ptatchwrite, W(holettirite, Q<uit 

Typing "C" puts the program into console mode for working with and altering 
the file. Typing "P" puts the prograin into patchwrite mode for dumping a file 
in hex, decimal, octal or ASCII format. Typing "U" puts the program into 
wholewrite mode for dumping, concatentating and/or moving blocks in files. 
"Q" exits from the patch/dump program and returns control to the Outer Level 
of commands. Console, patchwrite and wholewrite modes are described below. 

4.7.1 Console Mode 

In the console mode, the prompt line changes with each command. The full 
proB^t line on entering the mode is: 

Patch: R<ead, S(ave, H(ex, IKixed, G(et, Q<uit fnn] 

The number in the square bracket at the end of the line is the current block 
being patched. The first command to use is G(et, which will return with the 



Filename: <cr for unit i/o> 

In response, the name of the file to be patched is entered. However, a 
carriage return is typed instead if the disk (or other device) has no 

Paoe 102 



directory or has some problem u>ith the directory. Typing <cr> will generate 
the prompt: 

Unitnum to patch r^J>5,9..123 (0 luill Quit) 

When either a file name or a unit number has been entered, the next command to 
execute is R<eadi which will read a block from the file/unit. On entering 
R(ead» the prompt is: 

BLOCK: 

The block number of the file/unit specified is entered. Note that no range 
checking is provided on this read. Now* using the H<ex command will display 
the block entirely in hexadecimal characters. The IKixed command will display 
the block in ASCII characters, where possible, and hexadecimal values else- 
where. The prompt for IKixed is: 

Alter: pad vector 1,5,3.0 0..F hex characters. S<tuff. «<uit 

The vector keys on the terminal control cursor movement. Note that the cursor 
will not move off the data. Typing a hex character changes the character at 
the location of the cursor only if one or more of the data positions is 
changed. 

The S<tuff command displays the prompt line: 

Stuff for how many bytes: 

Enter a number from to 512. followed by a carriage return to cause patch to 
accept the number. The next prompt line is: 

Fill with what hex pair: 

Enter a byte value if hexadecimal. The data will reappear on the screen with 
the number of bytes specified filled with the value specified. Filling starts 
with the location of the cursor. 

Typing a "Q" will transfer control from the alter mode back to the console 
mode. S<ave is the next command to be executed to write the changed data back 
where it was read from. 

The console mode clears its memory after each session. 

4.7.2 Patchwork Mode 

In the patchwork mode, a full screen prompt appears: 

This procedure writes out sequential blocks to any file as a patch dump. 
Type the prefix character of the option to be changed. Type 'P' to PRINT. 
'«' to QUIT. 

A< Input File 
B( Begin Block ^ 
C< Num. of Blocks 

Page 103 



E< 


Output File 


G< 


Hexadecimal 


H< 


ASCII 


I( 


Decimal 


J( 


Oct,3l 


K( 


Decimal Bytes 


L( 


Oct,jl Byteti 


i1< 


Krtmch 


N< 


Double Space 



Follouiing each field is its current value. Typing the character i?^ front of 
the field positions the cursor after the field and removes the current value, 
Typintj "Y" or "T" sets a boolean value to True; any other character sets the 
field to False. The input and output file fields require a file name folioiued 
by a carriage return. The integer fields (begin block and num. of blocks) 
require a number folloused by a carriage return or space. Any other character 
sets the field to some unspecified value. 

Both Print and Quit cause control to return to the outer level of the patch/ 

dump program. Print first dumps the file in the requested format. The format 

may be specified by the options krunch and double space. Krunch, anhen True> 

removes blank lines betu>een logical output lines. Double space, when True> 
double spaces all output. The default is none. 

Mote that the patchtt'rite mode remembers its parameters across sessions while 
remaining in the patch/dump program. Patchwrite paginates its output. After 
each block is written/ a form feed is generated. PAGE(OUTPUTFILE). 

4^7.3 Wholeiiirite Hode 

In the u»holeu>rite mode, a full screen prompt appears: 

Ihis procedure writes any number of blocks from an existing file to a new 
file, unchanged. Simply specify the necessary parameters. Type 'P' to 
PUT, 'Q' to QUIT. 

Knput File 
S(tart Block 
N( umber of Blocks 
0(utput File 

Fields are changed the same way as for the patchwork mode, Wholewrite mode 
allows mixing/matching and minglinp of files. Both Put and Quit return 
control to the outer level of the patch/dump program- Put first writes to the 
file. 

Note that the wholewrite mode remembers its parameters across sessions while 
remaining in the patch/dump program. 

A,'S THE CALCULATOR 

The calculator program is entered by typing "X" for eX<ecute while in the 
Outer Level of commands. On entering the calculator, the following prompt 
appears: 

Pace lOi^ 



This prompt expects a one-litte expression in algebraic form as a re&ponse. Up 
to 25 different variables are available/ each uiith different values assigned 
using the syntax of the given grammar. Only the first eight letters may be 
used to distinguish betiiieen variables. Variables having a value may be used 
as constants. The tuio built-in variables are PI(3, 141593) and E(2. 718282). 
No distinction is made between upper and looter case letters- 

The Pascal !10D function (\) rounds the operands to integers- Wr¥<WlN(i; because 
this uses the Pascal definition of MOD (Jensen and Wirth» p. 108). the results 
obtained may not be as expected. 

The operand of the factorial f-AC function also is rounded to an integer tuhich 
roust be between and 33. inclusive, or the expression mill be rejected. 

The uparrou) is used for exponentiation. The ansiwer is calculated by using 
e '"" Y LN (X). Therefore, the operand must be positive or the expression ©ill 
be rejected. 

The constant LASTX is assigned the value of the previous correct expression 
and may be used in the next expression. This does au>ay with the necessity for 
reentering the same expression. 

Angles for the TKIG functions must be in RADIANS. Degree-to-radian conversion 
is accomplished by RADANGLE =^ (PI/180) « DEGAWGLE. 

The calculator program tuill bomb on an execution error if an overflow or 
underflouj occurs. If this happens, all user-assigned variables and their 
values will be lost. Type carriage return immediately following the prompt to 
leave the calculator. Calculator examples are given in Figure A'2:. 



> 


PI 

3. 


,14159 


> 


t 


2- 


.71828 


•■> 


A 


3. 


(FAC(3)/2) 
.00000 


-> 


3 


•f- 
9.. 


6 
.00000 


••> 


A 


•f- 
9, 


6 
,00000 



■> <RET> To end the program 



Figure 4-2. CALCULATOR EXANPLES 
Page 105 



4.9 GOTOXY PROCEDURE BIHDER 

The GOTOXY binder alters the SY31 EH. PASCAL oti the default P(refix disk to 
create and bind into the sqstem <once only) the GOTOXY procedure that enables 
the system to communicate correctly with a video terminal. Only system 
configurations containing a video temdnal need GOTOXY. The coordinates for 
the upper lefthand corner of the video screen must be X=0* Y=0. 

The GOTOXY binder is entered by typinp "X" for eX(ecute while in the Outer 
Level of commands^ followed by BINDER. When entered* it prompts for: 

local GOTOXY 

the procedure that must be created to suit the needs of the particular 
installation. 

To create "local GOTOXY", examine the file GOTOXY. TEXT, that is on the release 
diBl<> with the Screen -Oriented Editor. This file contains a few procedures 
for doing GOTOXY cursor addressing on several types of video terminals. If 
the procedure needed is m the file, remove it from comments, comment out any 
other procedures, recompile it and run BINDER on it. BIhDER is a self- 
instructing program. Directions for e>ntering it are given above. Possible 
errors that may occur while reviewirig the GOTOXY. TEXT and selecting the pro- 
cedure needed are: 

Possible Error Fix 

Mil memory reference at Remove the program heading and 

compile time try again 

Malue range error when (KKU-fe) should be the first thing 

executingBINDER in the GOTOXY file. 

If the needed procedure is not in the file, it must be created. The created 
procedure cannot be named &t)TOXY because this identifier is predeclared at the 
"$U-" level of compilation. 



Faqe 106 





APPENDIX A 




COrillAHD BUririARIF-S 


A. 3 


Outer Level 


A«2 


Screen -Oriented Editor 


A„3 


Line -Oriented Editor 


A, 4 


File Handler 


A„5 


Pascal Compiler 


A. 6 


Debugger 



Appendix A. 3 Outer Level 



A(«>sf?m 
C(omp 
D(el:)ug 
E(dit 

eX(ecute 
F ( i ler 
L(iT»k 
R(un 



Invokes the sy&tem Assembler. 

Invokes the system Compiler <Pascal or Basic). 

Invokes the Debugger. 

Invokes the system Editor (Screen -Oriented Editor or 

Yet Another Line-Oriented Editor), 

Executes the code file. 

Invokes the File Handler. 

Invokes the Linker. 

Executes the code file associated with the current work file. 

If none exists* the Compiler is automatically called* folloioed 

by the Linker* if necessary* before execution. 



Appendix A. 2 SCREEN-ORIENTED EDITOR 



<dottiin-arrou)> 

<up™arroffl> 

<right"-arrou)> 

< left-arrow > 

< space) 

< back -space) 

< tab > 

< return) 



moves (repeat-factor) lines down 

" " lines up 

" " spaces right 

" " spaces left 

" " spaces in direction 

" " spaces left 
moves (repeat-factor) tab positions in direction 
moves to the beginning of line (repeat-factor) lines in 
direction. 



II \ii II i> ii^ii 
ii_ii 



change direction to backward 
change direction to forward 
moves to the beginning of what was 
inserted/exchanged 



Just found/replaced/ 



A(d,Just: Adjusts the indentation of the line that the cursor is on- Use 

the arrow keys to move, floving up (down) adjusts line above (below) 
by same amount of adjustment as current line. Repeat factors are 
valid. 



Page 107 



C(opy; Copies u>hat luas last inserted/cJeleted/zapped into the filp at the 
position of the cur&or. 

LKelete: Treitts. the stiirting positioii of the cursor 85 the anchor. Use any 
iooving commands to mov<? the cursor. <etx> deletes everything 
bett«t?en the curn-or and the anchor- 

F«;infJ: Operates in Kiteral or Koken mode. Finds the <targ> string. Repeat 
factors are valid, direction is applied- "S" = use same string as 

bf'fure, 

Knsert: Inserti^^ text. Can use < back space) and <del> to reject part of your 
insertion. 

vKump: Jumps to the beginning, end or previously set marker- 

IKargin: Adjusts anything between two blank lines to the margins u»hich have 
been set. Command characters protect text from being margined. 
Invalidates the copy buffer. 

P(age; floves the cursor one page in direction. Repeat factors are valid, 
direction is applied. 

Q<uit; Leaves the editor. You may U)pdate, E)xit, W)rite, or K>eturn. 

R(eplace: Operates in Kiteral or T*oken mode- Replaces the <targ> string 
with the <5ubs> string. M(erify option asks you to verify before 
it replaces. "S" option uses the Same string as before. Repeat 
factors replace the target several times. Direction is valid. 

B<et: Sets fKarkers by assigning a sti'ing name to them. Sets E<nvironffient 
for A(uto-indent, F<illing, margins, Koken, and Ctomroand characters. 

VCerify: Redisplays the screen itfith the cursor centered. 

eX(change: Exchanges the current text for the text typed while in this mode- 
L-ach line must be done separately. <back-space> causes the 
original character to re-aapear. 

Z<ap: Treats the starting position of the last thing found/replaced/inserted 
as an anchor and deletes everytning between the anchor and the current 
cursor position, 

< repeat- factor > is any number typed before a command. Typing a / is the 
infinite number- 



Appendix A. 3 YALOE 
n - an argument m *■ macro number 

nA; Advance the cursor to the beginning of the n th line from the current 

P.sge 108 



position. 
8: Go to the Be5ini»in.9 of the file. 
nC: Change? by deleting n characters and inserting the following text. 

Terminate text with <e&c>. 
nD: Delete n characters^ 

E: Erase tt»e screen- 
nF: f-'ind the n th occurrence from the current cursor position of the 

follo««ing string. Terminate target string with <esc:>. 
nG: Get - ditto - 
H: - invalid -■ 

I: Insert the following text. Terminate text with <esc>.- 
nJ; ».<ump cursor n characters. 
nK: Kill n lines of text. If current cursor position is not at the start 

of the line^ the first part of the line remains- 
nL: List n lines of text, 
mil: Define macro number m. 
nNm: Perform macro number mi n times. 

nO: On> off toggle. If on> n lines of text will be displayed above and 
below the cursor each time the cursor is moved. If the cursor is in 
the middle of a line then the line will be split into two parts. 
The default is whatever fills the screen. Type to turn off. 
P: - invalid - 

Q; ^uit this session* followed by: 

U:(pdate Write out a new SYGTErl.URK.TLXT 
E: (scape Escape from session 
R; <eturn Return to editor 
R: Read this file into buffer (insert at cursor); 
'R' must be followed by (file name) (esc>j 

WARNING; If the file will not fit into the buffer, the content 
of the buffer becomes undefined ! 
nS: Put the next n lines of text from the cursor position into the Save 
Buffer. 
T: ~ invalid - 

U: Insert (Unsave) the contents of the Save Buffer into the text at 

the cursor* does not destroy the Save Buffer. 
V: Verify; display the current line 
W; Write this file (from start of buffer); 

'W' must be followed by (file name) (esc) 
nX: Delete n lines of text* and insert the following text* terminate 
with (esc) 
Y: - invalid ~ 

Z: - invalid •■ 



Appendix A.^ File Handler 

B(ad-blks Scans the disk and detects bad blocks, listing the number of 
each. 

C(hange Changes file or volume name. 

D(ate Lists current system date and enables user to change date.; 
format is dd-mmm-yy. 



Page 109 



E<T{t-dir Lists the directory in more detail than the L<dir command« 

C(et Loads the designated file into the u.torl< file. 

K(ruiich iloves the files on the specified volume so that unused blocks 

are combined at the end of the disk; disk files only. 

L<dir Lists a disk directory, or subset of one> to the volume and 

file specified; default is CONSOLE::). 

N<ake Creates a directory entry with the specified filename. 

Wmt Clears the mork file. 

P<refix Changes the current default volume to the volume specified. 

Qdjjt Returns control to the Outer Level of commands. 

R<em Removes file entries from the directory, 

S(ave Saves the work file under the specified file name,. 

Krans Copies (transfers) the specified file to the specified 

destination volume; directories are not changed automatically. 

M<olb Lists the volumes currently on-line along u/ith their 

corresponding device numbers. 

W<hflt Identifies the file name and state (saved or not) of the work 

file, 

X(affiine Attempts to recover bad blocks physically; a bad-block scan 

should be done first. 

Z(ero Reformats the specified volume and makes the old directory 

irretrievable. 



Appendix A. 5 Pascal Compiler 

D: Causes the Compiler to insert breakpoint instructions into 

the code Pile during compilation so that the Debugger can be 
used more effectively. Default is '-', no breakpoints 

G: Affects the boolean variable GOTOOK to allow the use of the 

Pascal GOTO statement in the program. Default is ' -' > no 
GOTO. 

I: When followed by a '+•■', causes the Compiler to generate code 

after any I/O statement to check for successful completion of 
I/O. This is the default. 

When followed by a ' -' , inhibits I/O checking. 

Page 110 



When folloiued by a file name/ includes another source file 
into the compilation. 

L: Causes the Compiler to generate a listing of the source 

program on a specified file. If a '+', the default file is 
KSYSTEII. LIST -TEXT. Default if '-', no listing. 

Q: "Quiet compile" option used to suppress output to the CONBOLIi 

listing procedure names and line numbers during compilation. 
Default is set to the current value of SYSCOI1'\iiISCIMFO.SLOU- 
TERH. 

R: Affects the value of the boolean variable RAHGECHECK to perform 

checking on array subscripts and assignments to variables of 
subrange types. Default is '+', code for checking is inserted- 

S: Causes the Compiler to operate in swapping mode so that only 

one of the tu>o main parts of the Compiler (declarations proces- 
sor or statement handler) is in main memory at one time; 
freeing about Z>00 mords for symbol table storage. Default is 
'"' > no swapping. 

U: Affects the boolean variable SYSCOMP to determine if the 

compilation is of a user program or a system program. Default 
is '+'j user program. 

When followed by a file name* U: names the library file. 



Appendix A. 6 Debugger 



EXECUTE OPTIONS 



C(rawl Executes a program one statement at a time* waiting for input 
from user between stops. 

R<esume Runs program normally until a BREAK or breakpoint is encountered 
or a non-fatal runtime error occurs. 

U<alk Runs a program one statement at a time at an adjustable rate. 

EXAIIIbE ilODE OPTIONS 

'< ' or '>' Changes the direction of link traversal to go toward the 

callees* down the call chain. 

'>' or '.' Changes the direction of link traversal to go toward the 
callers* up the call chain. 

<eBc> Returns control to the Outer Level of commands. 
<CR> Clears the line with the '«' and moves down one line- 

Page 111 



<nKL-D> Hoves the 'k' doum one line. 

<nKl..-U> CtoveB thf? 'K' up one lino- 

« link'i Indicates hotu many links to move up or down the dynamic or 

!i;tatic: ch^un; enter a number 0-9- 

U(rei)i{point Used to B'let or C( lear a breakpoints 

C(ra«»l Resumes running the program in crauil mode at the point the 

Debugger was invoked. 

D(atij Used to examine the DATA and parameter segments of a procedure. 

E<ra!>(? Clars the memory display buffer on the screen. 

H(t>ap Displays the portion cf memory specified by the octal address 

and lenirth- 

Kink Tog_qles the default link from dynamic to static* and vice-versa. 

nCnve Finds the specified procedure and makes it the current pro- 

c:edure. 

R(ei;ume Resumes normal execution of the protjram at the point the 

Debugger was invoked. 

S(ti:H:k Examines the stack area belonging to the specified procedure. 

U(pd(3te Refreshes the memory display buffer. 

tKalk Resumes execution of the program in lualk mode at the point where 

the Debugger was invoked. 



Pa^je 112 





APPENDIX 8 




TABLES 


8„1 


RuTjtime Errors 


B„2 


Syntax Errors 


B„3 


I/O Results 


B„^ 


Unit Numbers 


B„5 


P-riachine Opcodes 


B.6 


Assembler Syntax Errors 


B.7 


ASCII 



Appendix B„.l RUNTII1E ERR0R8 
Version 3 

System error r-ATAL 

1 Invalid index, value out of range (XINVWDX) 

2 Wo sejiiment, bad code file (XNOPROC) 

3 Procedure not present at exit time (XWOEXIT) 
A Stack overflow (XSTKWR) 

5 Integer overflow (XINTOVR) 

6 Divide by zero (XDIVZER) 

7 Invalid memory reference <bu5 timed out) <XBADI1EM) 

8 User Break (XUBREAK) 

9 System I/O error (XSYIOER) FATAL 

10 User I/O error <XUIOERR> 

11 Unimplemented instruction (XNOTlilP) 

12 Floating Point math error <XFPie«R) 

13 String too long (XS2L0NG) 

14 Halt* Breakpoint (without debugger in core) (XHLTBPT) 

15 Bad Block 

All fatal errors either cause the system to rebootstrap, or if the error luas 
totally lethal to the system, the user will have to reboot. All errors cause 
the system to re-initialize itself <call system procedure IMITIALIZE). 



Appendix B.2 SYNTAX ERRORS 
Version 3 



Page 113 



i: Error in simple type 

2: Identifier expected 

3: 'PROGRAil' expected 

A: ')' expected 

5: ': ' expected 

A: Illegal sysibol 

7: Error in parameter 'list 

8; 'OF' expected 

9: '<' expect-ed 

10: Error in type 

U: T' expected 

12: '3' expected 

13: 'END' expected 

\A: 'i ' expected 

15; Integer expected 

\6: '-' expected 

17: 'BEGIN' expected 

18: Error in declaration part 

19: Error in <fiBld-li5t> 

20: '.' expected 

21: 'K' expected 

22: 'Interface' expected 

23: 'Implementation' expected 

2A\ 'Unit' expected 

'50: Error in constant 

51: ':==' expected 

52: 'THEN' expected 

53: 'UNTIL' expected 

5^: 'DO' expected 

5^>: 'TO' or 'DOUNTO' expected in for statement 

5A: 'IF' expected 

57: 'FILE' expected 

59: Error in (factor > (bad expression) 

59: Error in variable 

101: Identifier declared twice 

102: Low bound exceeds high bound 

103: Identifier is not of the appropriate class 

iOA: Undeclared identifier 

105: Sign not allowed 

lOA: Ntjmber expected 

107: Incompatible subrange types 

108: File not allouied here 

109: Type must not be real 

110: <tagfield> type must be scalar or subrange 

111: Incompatible u»ith (tagfieid) part 

112: Index type must not be real 

113: Index type roust be a scalar or a subrange 

114: Base tiflje must not be real 

115: Base type must be a scalar or a subrange 

116: Error in tigje of standard procedure parameter 

117: Unsatisfied forward reference 

Page 114 



Ii8: Forward reference type identifier in variable declaration 

119: Re-specified params not OK for a forward declared procedure 

120: Function result type must be scalar, subrange or pointer 

121: File value parameter not allowed 

122: A foriuare declared function's result type can't be re-specified 

123: Hissing result type in function declaration 

12''1: F "format for reals only 

125: Error in type of standard procedure parameter 

126: Number of parameters does not agree with declaration 

127: Illegal parameter substitution 

128: Result type does not agree with declaration 

129: Type conflict of operands 

130: Expression is not of set ti^e 

131: Tests on equality allowed only 

132; Strict inclusion not allowed 

133: File comparison not allowed 

X3A: Illegal type of operand<5) 

135: Type of operand must be boolean 

136: Bet element type must be scalar or subrange 

137: Set element types must be compatible 

138; Type of variable is not array 

139: Index type is not compatible with the declaration 

1^0; Type of variable is not record 

141: Type of variable must be file or pointer 

142; Illegal parameter solution 

143: Illegal type of loop control variable 

lAA: Illegal type of expression 

145: Type conflict 

146: Assignment of files not allowed 

147: Label type incompatible with selecting expression 

148: Subrange bounds must be scalar 

149: Index type must be integer 

150: Assignment to standard function is not allowed 

151: Assignment to formal function is not allowed 

152: No such field in this record 

153: Type error in read 

154: Actual parameter must be a variable 

155: Control variable cannot be formal or non-local 

156: tlultidefined case label 

157: Too many cases in case statement 

158; No such variant in this record 

159: Real or string tagfields not allowed 

160: Previous declaration was not forward 

161: Again forward declared 

162: Parameter size must be constant 

163: Hissing variant in declaration 

164: Substitution of standard proc/func not allowed 

165: tlultidefined label 

166: Hultideclared label 

167: Undeclared label 

168: Undefined label 

169: Error in base set 

170: Value parameter expected 

Page 115 



.17!: Standard file luas re-declared 

172: Undeclared external file 

r/'^: Pascal function or procedure expected 

182: Nested units not allowed 

183: External declaration not allomeci at this nesting level 

18-^: External declaration not alloiuecj in interface section 

135: Segment declaration not allowed in unit 

186: Labels not allouied in interface section 

107- Attempt to open library un5ucce<;sful 

183: Unit not declared in previous unes declaration 

189: 'Uses' not alloiued at this nestr^ng level 

190: Unit not in library 

191: No private files 

192: 'Uses' must be in interface sec ^r- ion 

193: Hot enough room for this operat:LOn 

194: Comment must appear at top of program 

195: Unit not importable 

201: Error in real number - digit expected 

202: String constant must not exceed source line 

203: Integer constant exceeds range 

20-'1: 3 or 9 in octal number 

250: Too many scopes of nested identifiers 

2'51: Too many nested procedures or fijnctions 

252: Too many forward references of procedure entries 

253: Procedure too long 

25^: Too many long constants in this procedure 

256: Too many external references 

257: Too many externals 

258; Too many local files 

259: Expression too complicated 

300: Division by zero 

301: No case provided for this value 

302: Index expression out of bounds 

303: Value to be assigned is out of bounds 

304: Element expression out of range 

390: Implementation restriction 

399: Implementation restriction 

'100: Illegal character in text 

401: Unexpected end of input 

402: Error in writing code file, not enotjgh room 

403: Error in reading include file 

404; Error in writing list file, not enough room 

405: Call not allowed in separate procedure 

406: Include file not legal 



Pige 116 



Appendix B.3 I/O RESULTS 
VerF>ioT» 3 

No error 

1 Bad Block/ Parity error (CRC) 

2 Bad Unit Numer 

3 Bad Hode/ Illegal operation 

4 Undefined hardware error 

5 Lost uniti Unit is no longer on-line 

6 Lost filej File is no longer in directory 

7 Bad Title* Illegal file name 

8 Wo room* insufficient space 

9 No unit, No such volume on line 

10 No file, No such file on volume 

11 Duplicate file 

12 Not closed I attempt to open an open file 

13 Not open, attempt to access a closed file 

lA Bad format, error in reading real or integer 

15 Ring buffer overflow 





Appendix 8.4 UNIT NUMBERS 




Version 3 


NUilBER 


V0LU11E NAUE 



1 


< empty > 
CONSOLE 


2 


SYSTERn 


3 


(GRAPHIC 


5 
6 


floppyO 
floppyl 
PRINTER 


7 


available ~ <un implemented) 


8 


REilOTE < reserved for future use) 


9 


blockl 


10 


block 2 


11 


blocks 


12 


block 4 


Devices 9 - 


• 12 are block -structures devices, in most 



Page 117 



Appendix B.5 P-MACHINE OP-CODES 
Version 3 



,1 



rinemonic 



Instruction 
Code 



Parameters 



Description 



Constant One Uord Loads 
SLDC 0, . 31 



LDCH 



I.DCB 



LDCI 



LCA 



152 



128 



129 



130 



Short Load Word Constant (Value 0-31). 
Pushes the opcode^ iBith high byte 
zeroi onto stack. 

Load Constant Nil. Pushes nil onto 
stack . 

U8 Load Constant Byte. Pushes UB, luith 
high byte zero* onto stack. 

\4 Load Constant Word. Pu&hps U onto 

stack. 

B Load Constant Address. Pushes the utord 
Address of the constant aith offset B 
in constant uiord block. 



Local One Word Loads and Store 
SLDL1-.16 32.. A7 



LDL 



LLA 



STL 



135 



132 



16A 



Short Load Local Word. SLDLX fetches 
the word with offset X in i1P activation 
record and pushes it. 

Load Local Word. Fetches the ujord utith 
offset B in IIP activation record and 
pushes it. 

Load Local Address. Fetches address of 
the word mith offset B in iiP activation 
record and pushes it. 

Store Local. Stores Tos into word with 
offset B in HP activation record- 



Global One Uord Loads and Store 
SLD01..16 48.. 63 



Short Load Global Word. SLDOX fetches 
Page 118 



LIXJ 



LAO 



mo 



133 



134 



165 



the fflord tuith offset. X in base 
activation record and pushes it. 

Load Global Word. Fetches the tuord 
iBith offset B in base activation 
record and pushes it. 

Load Global Address. Pushes the word 
addres of the word with offset B in 
base activation record. 

Store Global Word. Stores Tos into thp 
word with offset B in base activation 
record. 



Intermediate One-Uord Loads and Store 



LOD 



LDA 
STR 



137 



136 
166 



DB>B 



DB,B 
D6<B 



Load Intermediate Word. DB indic.itec 
the number of static links to traverse 
to find the activation record to use, 
B is the offset within the activation 
record. 

Load Intermediate Address. 

Store Intermediate Word. 



Indirect One-Word Loads and Store 
STO 196 



Store Indirect. Tos is stored into the 
word pointed to by Tos-1. 



Extended One-Word Loads and Store 
LDE 154 LIB,B 



LAE 
STE 



155 
217 



UB.B 
UB.B 



Load Word Extended. UB is segment 
number. B is the offset within the 
segment. 

Load Address Extended. 

Store Word Extended. 



Multiple Word Loads and Stores (Sets and Reals) 



LDC 



131 



LDH 



208 



B»UB Load llultiple Word Constant. 8 is the 
offset within the constant word block* 
and UB is the number of words to load. 
Push the block onto the stack. 

Iffi Load llultiple Words. Tos is a pointer 

Page 119 



to the beginniny of a block of Ub words. 
Push the block orito the stark „ 

1^:12 UB Store Oultiple Words- Tos i& a block of- 

UB words. Tos-1 is a Bjord pointer to 
a similar block. Transfer the block 
from the stack to the destination 
b lock « 



Bijte Arrays 

! [>8 167 Load Byte. Push the byte (after 

zeroing high byte) pointed to by byle 
pointer Tos. 

STB 200 Store Byte. Store byte Tos into the 

location specified by Byte Pointer 

Tus-1. 



Record and Array Indexing and Assignment 

itfiV 197 B Hove Words. Tos is a source pointer 

to a block of B words, los-l is a 
destination pointer to a similar blocks 
Transfer the block from the source to 
the destination. 

SINDO. .7 120. .127 Short Index and Load Word. SINDX 

indexes the word pointer Tos by X 
u>ords> and pushes the mod pointed to 
by the result. 

INO 230 B Static Index and Load Word. Indexe 

the word pointer Tos by B words, and 
pushes the word pointed to. 

iHC 231 B Increment Field Pointer. The word 

pointer Tos is indexed by B words and 
the resultant pointer is pushed. 

IXA 215 B Index Array. Tos is an integer index. 

Tos-1 is the array base word pointer, 
and B is the size (in words) of an 
array element. A word pointer to the 
indexed element is pushed. 

IXp 216 L^I.UB:! Index Packed Array. Tos is an integer 

index. Tos-l is the array base word 
pointer- UB(1) is t-fie number of 
element -per-word. and L19(2) is the 
field-width (in bits). Compute and 
push a packed field pointer. 

P,ige 120 



LDP 



STP 



201 



202 



Load A Packed Field. Pu&h thp field 
described by the packed field pointer 
To5. 

Store Into A Packed Field, Tos is the 
data» Tos-l is a packd field pointer. 
Store Tos into the field described 
by To5"l. 



Loigicals 




LAND 


161 


LOR 


160 


LNOT 


220 



LEUSW 



GEUSW 



190 



181 



Logical And. And Tos into Tos~l„ 

Logical Or. Or Tos into Tos-l„ 

Logical Wot. Take one's complement 
of Tos, 

Compare Unsigned Word <=. Compare 
unsigned word of Tos-l to unsigned 
iBord of Tos and push true or false. 

Compare Unsigned Word >=. Compare 
unsigned u>ord of Tos-l to unsigned 
word of Tos and push true or false. 



Integers 
ABI 



HGI 

ADI 
SB I 

\1P7. 



224 



225 

162 
163 

140 



Absolute Value of Integer. Take 
absolute value of integer Tos. Result 
is undefined if Tos is initially 
-32768. 

Hegate Integer. Take the two's co 
complement of Tos. 

Add Integers. Add Tos and Tos-l, 

Subtract Integers., Subtract Tos from 
Tos-l. 

Ilultiply Integers. Ilultiply Tos and 
Tos-l. This instruction may cause 
overflow if result if larger than 
16 bits. 



DUPi 



DVI 



226 



141 



Copy Integer. Duplicate one word 
on Tos, 

Divide Integers. Divide Tos-l by 
Tos and push quotient. 



Page 121 



I10DI 1A3 Ptodulo Integers. Divide T05-I by fo!:^ 

and push the remainder. 

aiK 203 Check Against Subrange Bounds- Insure 

that Tos-l < = To5 -2 < = Tos^ leaving 
Tos-2 on the stack. If conditions are 
not satisfied a run-time error occurs. 

HQUI 176 Compare Integer =. Compare Tos-l to 

to Tos and push true or fal&f?. 

HEQI 177 Compare Integer < >- Compare Tos-l to 

to Tos and push true or false. 

LEQI 178 Compare Integer <=. Compare Tos-l to 

to Tos and push true or false, 

GEQI 179 Compare Integer >=. Compare Tos-l to 

to Tos and push true or false. 



Reals (All Over /Under flows Cause a Run-Time Error) 

PLT 20-^ Float Top-of-Stac:k. The integer Tos 

is converted to a floating point 
number - 

TNC 190 Truncate Real. The real Tou is 

truncated and converted to an integer. 

RWD 191 Round Real. The real Tos is rounded, 

then truncated and converted to an 
integer. 

ABR 227 Absolute Value of Real. Take the 

absolute value of the real Tori. 

Add Reals. Add Tos and Tos-J.- 

Negate Real. Negate the Real fo6„ 

Subtract Reals. Subtract Tos from 
Tos-l. 

rtPR 19A riultiply Reals- llultiply Tos and 

Tos-l. 

[)UP2 198 Copy Real. Duplicate two words on 

Tos. 

DVR 195 Divide Reals. Divide Tos-l by Tos. 

EOIWEAL 205 Compare Real =. CoWare Tos-l to Tos 

f^age 122 



ADR 


192 


NCR 


228 


BBR 


193 



and push trup or tahio. 



LE«REAl. 



GEQREAL 



206 



20/ 



)are Real <=. Compare Tos -1 to los 

and push true or faliie. 

Compare Real >=. Compare los 1 to Tog 

and push true or fal^e. 



Bets 



ADJ 



199 



SRS 



IhB<l 



UNI 



INT 



DIF 



188 



218 



219 



220 



221 



EQUPUR 


182 


LEOPWR 


183 


GEOPWR 


18^ 


Byte Arrays 




fcQUBYT 


185 


LEftBYT 


186 


GEOBYT 


187 



UB Adjust Set. The set Tos is forced to 
occupy UB u»ords» either by expansion 
(putting zeroes "between" Tos and 
Tos-1) or compression (chopping of 
high luords of set), and its length 
word is discarded. 

Build Subrange Set. The integers Tos 
and Tos~l are checked to insure that 
0<=Tos<=4079 and 0<~To&-l<=4079, a 
run-time error occur ing if not. The 
set rToS"l..To53 is pushed, (The set 
r 3 is pushed if Tos-1 > Tos.) 

Set rierobership. See if integer Tos-l 
is in set Tos, pushing true or false- 
Set Union. The union of sets Tos and 
Tos-1 is pushed. (Tos or Tos-l.) 

Set Intersection. The intersection of 
sets Tos and Tos-1 is pushed. (Tos 
and Tos-1.) 

Set Difference. The difference of sets 
Tos-1 and Tos is pushed, (Tos-l and 
not Tos.) 

Set Compare -. 

Set Compare (= (Sutoset of). 

Set Compare >= (Stqierset of). 



B Byte Array Compare =. 
B Byte Array Compare <-, 
8 Byte Array Compare >-. 



Page 123 



Jumps 

Ujp 138 SB Uticonditional xkmp. 

FvJP 212 SB False Jump. Jump is Tos ir> false. 

EFj 210 SB Equal False Jump. Jump if inte,g(?r 

To5 < > T0S--I. 

NFJ 211 SB Not Equal False Jump. Jump if inteper 

Tos = Tos-l. 

\}^.Pl 139 U Unconditional Long Jump. Jumi' 

unconditionally to location with off!>et 
U from current location.. 

yj^fl 213 U False Long Jump. Jump to location with 

offset U from current location if Tos 
is false. 

Xjp 21 -^ B Case Jump- The first word uiith offset 

B in constant word block, Ul, is word- 
aligned and is the minimi«n index of 
the table. The next word up, U2, is 
the maximum index. The case table is 
the next U2-U1 words. 

If Tos, the actual index, it- Jn the 
range of U1..U2 then Jump to location 
with offset U3 from current location. 
Where U3 is the contents of the word 
pointed by Tos in the case table- 



Procedure and Function Calls and Returis 

CPL lAA IS Call Local Procedure. Cal procedure 

UB, which is an immediate child of the 
currently executing procedure and in 
the same segment™ Static link of i1SCU 
is set to old I1P. 

CPG 1^5 UB Call Global Procedure. Cal procedure 

UB, which is at lex level 1 and in the 
same segment. The static link of the 
nSCU is set to base. 

CPi 1A6 DB,UB Call Intermediate Procedure. Call 

procedure UB, a^ich is at lex level DO 
less than the currently executing 
procedure and in the same segment. Usf* 
that activation record's static link 
35 the static link of the new ilSCU. 

Pace 12^ 



CXI 



1A7 



CXG 



CXI 



148 



149 



UB1,UB2 Call Local External Procedure^ Call 
procedure UB<2) which is an immediato 
child of the currently executing 
procedure and in the setjAsent UB(1)„ 

UB1,UB2 Call Global External Procedure, Call 
procedure UB<2) urfiich is at lex level 
1 and in the seqwent U<1). 

UB1>DB,UB2 Call Intermediate External Procedure,. 
Call procedure UB<2> which in at lex 
level DB less than the currently 
executing procedure, and in the sepn^ent 
UB<1). 



CPF 



151 



mu 



150 



LGL 



153 



DB 



Call Formal Procedure. Tor> contains 
segment number and procedure number and 
Tos-1 contains static link for the 
called procedure. 

Return From User Procedure. Static 1 
link if discarded, MP is reset from 
I1SDYW, IPC is also reset from tISIPC. 
If segment number is not zero, segment 
pointer is set from segment dictionary,, 
Stack pointer is decremented by B. 

Load Static Link Onto Stack. DB 
indicates the number of static link 
to traverse to get the static link to 
load. 



System Control 
SIGNAL 222 



WAIT 



LPR 



223 



157 



SPR 



209 



Signal. Tos is a semaphore address 
signal on this semaphore. 

Uait on Semaphore. Tor. is a semaphore 
address wait on this semaphore. 

Load Processor Register. Tos is a 
Reg ^ (If it is positive it is one of 
the TIB registers. If not -1 is 
current task pointer, -2 is s^egment 
die. pointer and -3 is ready queue 
pointer.) Load contents of this 
register on top of stack. 

Store Processor Register. Tos-1 is a 
register number (same definition as 
LPR). Store Tos in tbis register. 



Page 125 



Debugger 

BPT 158 Break Point. 

KBP 157 Return From Breakpoints 

HiE^ellaneouB 

HOP 156 No Operation. 

SWAP 189 Siuap Top-of-Stack u>ith Next to 

Top- of -Stack. 



Pane 126 



Appendix B.6 ASSEMBLER SYNTAX ERRORS 

Versiion 3 

This section listB all the general errors found in the ERRORS file* specific 
machine errors are found in the sections belom dealing with machine specific; 



1 

2 

3 

A 

5 

6 

7 

& 

9 

10 

11 

12 

13 

lA 

15 

16 

17 

18 

19 

20 

21 

22 

23 

2^ 

25 

26 

27 

28 

29 

30 

31 

32 

33 

35 
36 
37 
38 
39 
-^0 
^1 
42 
A3 
AA 
A5 
46 
47 



Undefined label 

Operand out of range 

Must have procedure name 

Number of parameters expected 

Extra garbage on line 

Input line over 80 characters 

Not enough ifs 

flust be declared in ASECT before use 

Identifier previously declared 

Improper format 

EOU expected 

Must EQIJ before use if not to a label 

Macro identifier expected 

Word addressed machine 

BackiBard ORG not alloiued 

Identifier expected 

Constant expected 

Invalid structure 

Extra special symbol 

Branch too far 

Variable not PC relative 

Illegal macro parameter index 

Not enough macro parameters 

Operand not absolute 

Illegal use of special symbols 

Ill-formed expression 

Not enough operands 

Cannot handle this relative 

Constant overflow 

Illegal decimal constant 

Illegal octal constant 

Illegal binary constant 

Invalid key word 

Unexpected end of input - after macro 

Include files must not be nested 

Unexpected end of input 

Bad place for an include file 

Only labels Si comments may occupy column one 

Expected local label 

Local label stack overflow 

String constant must be on 1 line 

String constant exceeds 80 chars 

Illegal use of macro parameter 

No local labels in A^CT 

Expected key word 

String expected 

Bad blockj parity error <crc) 



Page 127 



^: Bad unit number 

^9; Bad mode/ illegal operation 

50: Undefined hardunare error 

51: Lost unit/ no loncjer on-line 

52: Lost file» no Ion per in directory 

53: Bad title* illegal file name 

5^: No room# insufficient space 

55: No unit/ no such voltiBin on-line 

56: No file/ no such file on volumn 

57: Duplicate file 

58: No closed/ attempt to open an open file 

59: No open/ attempit to access a closed file 

60: Bad format/ error in reading real or integer 



Pagt? 128 



Appendix B.7 AroericaTi Standard Code for Information Interchange 

Version 3 

000 00 NUl. 32 040 20 SP 6A 100 40 « 96 140 60 ^ 

1 001 01 SON 33 040 21 ! 65 101 41 A 97 141 64 a 

2 002 02 STX 34 042 22 " 66 102 42 B 93 142 62 b 

3 003 03 ETX 35 043 23 « 67 103 43 C 99 143 63 c 

4 004 04 EOT 36 044 24 $ 78 104 44 D 100 144 64 d 

5 005 05 ENG 37 045 25 % 69 105 45 E 101 145 65 e 

6 006 06 ACK 38 046 26 8 70 106 46 F 102 146 66 f 

7 007 07 BEL 39 047 27 ' 71 107 47 G 103 147 67 q 
Q 010 08 BS 40 050 28 < 72 110 43 H 104 150 68 h 
9 Oil 09 HT 41 051 29 ) 73 111 49 I 105 151 69 i 

10 012 OA LF 42 052 2A » 74 112 4A J 106 152 6A J 

11 013 08 MT 43 053 2B + 75 113 48 K i07 153 68 k 

12 014 OC FF 44 054 2C > 76 114 4C L 108 154 6C 1 

13 015 OD CR 45 055 2D - 77 115 4D M 109 155 6D m 

14 016 OE SO 46 056 2E . 78 116 4E N 110 156 6E n 

15 017 OF SI 47 057 2F / 79 117 4F 111 157 6F o 



32 040 


20 


SP 


33 040 


21 


! 


34 042 


22 


II 


35 043 


23 


« 


36 044 


24 


$ 


37 045 


25 


% 


38 046 


26 


S 


39 047 


27 


/ 


40 050 


28 


< 


41 051 


29 


) 


42 052 


2A 


» 


43 053 


2B 


+ 


44 054 


2C 


> 


45 055 


2D 


- 


46 056 


2E 


M 


47 057 


2F 


/ 


48 060 


30 





49 061 


31 


1 


50 062 


32 


2 


51 063 


33 


3 


52 064 


34 


4 


53 064 


35 


5 


54 066 


36 


6 


55 067 


37 


7 


56 070 


38 


8 


57 071 


39 


9 


58 072 


3A 


: 


59 073 


3B 


> 


60 074 


3C 


< 


61 075 


3D 


= 


62 076 


3E 


> 


63 077 


3F 


7 



16 020 10 DLE 48 060 30 80 120 50 P 112 160 70 p 

17 021 11 DCl 49 061 31 1 81 121 51 S 113 161 71 q 

18 022 12 DC2 50 062 32 2 82 122 52 R 114 162 72 r 

19 023 13 DC3 51 063 33 3 83 123 53 S 115 163 73 b 

20 024 14 DC4 52 064 34 4 84 124 54 T 116 164 74 t 

21 025 15 NAK 53 064 35 5 85 125 55 U 117 165 75 u 

22 026 16 SYN 54 066 36 6 86 126 56 V 118 166 76 v 

23 027 17 ETB 55 067 37 7 87 127 57 \4 119 167 77 u! 

24 030 18 CAW 56 070 38 8 89 130 58 X 120 170 78 x 

25 031 19 En 57 071 39 9 89 131 59 Y 121 171 79 y 

26 032 lA SUB 58 072 3A : 90 132 5A Z 122 172 7A z 

27 033 IB ESC 59 073 3B ; 91 133 5B f 123 173 7B <. 

28 034 IC FS 60 074 3C < 92 134 5C \ 124 174 7C ! 

29 035 ID GS 61 075 3D = 93 135 50 3 125 175 7D > 

30 036 IE R5 62 076 3E > 94 136 5E '^ 126 176 7E 

31 307 IF US 63 077 3F ? 95 137 5F 127 177 7F DEI 



Page 129 



Page 130 



APPKNDIX C 
UCSD PASCAL SYNTAX DIAGRAHS 



Appendix C UCSD Pasral Syntax Diaprams 



Paqe 131 



UC5D PASCAL SYHTAX DIAGRAIIS 



IDENTIFIER 



UNSIGNED INTEGER 



UNSIGNED NUMBER 



--dEEzy* — ' 



^-<Ili!l>--- 



-r^~> 



unsiijned nteqei 



unsignt'd mlrgo 



a ~t 



U(7y 



r<4n 



unsiqnefl 



UNSIGNED CONSTANT 



k>^ 



onsrant" ^dennfiail (^ 



-»| u nsigncij numlier | 



► ( tMIL ) - 



►0-f^.^^^^(^- 



CONSTANT 



t ) 1 f — ►["constant" identifier I — t 
y"*^ T ' — ►] unsigned constant 

>'(/V-^^ ( character ) '-*•(/) 



VARIABLE 



► [ "vanatjle" identitier |— ► 



r M "vanatjle" identifier 

I |J "tiBlrl" identifier 



}-»'-»{TW H expression"! t^m)"* 

I r 



Oc 



-^>~^ 



o 



►I unsigned constiint r~ 
-^\ variable I 



■| -funclion" i dKrmfter[ — ^►(^1 J-^-» j Hxpression | — [""►(j^) ►' 

I r^ — I 



o-- 



-»^7V-- H gop'""'"" i — *^j_)- 






KD- 



O 



O^ 




SIMPLE TYPE 



SIMPLE EXPRESSION 



~^W "tvPe" identifier 



-<D-*-"K 



0- 



O— 



-- H constant "~| -»0—H~ 







8dini«j«J-->fTV- — ->: 



-- ^packed] 



;wrsKACTivl) .«_,™, 

»(T)-»- F''VPe" identif l^ — 

o 



».(aRRAY>»(T)-^> ] simple type "! '->^_)-^<Of)-»-{T^^- 



-» < FILE > - 



-» ( SET ) ►{o^-— ♦[^ 



"♦CiiilEsD^HIiiijiD — ►G^D" 






k>^ 




EXPRESSION 




PARAMETER LIST 



A^i 



ntifiei I ■ I »(7V J- 




» ( var' 

♦^UNCTION^ 
I 

i^^rocedure)-^ 



o- 



-CD-~ 



"Tz: 



0-*L 



(CASE)— l-H idei 



itifier L^(7) * » r''VPg" idnr'ifier 




<I> 






EEh-K^^O—4: 



f^aoe 132 



UCSD PASCAL SYNTAX DIAGRAtIS 



STATEMENT 

I unsigned integer |—^^ .' y 



:: 



— j-W variable | " " A ^C'^ /" " ^i sxpressionj— 



rfunction" identifie 



—►r"procedure" identifier I — r^^ ( ) — ^ — i — ►[ expr ession j — r — * ►( i / ► 

I "procedure" identifier I 



-> (BEGIpr) j-^ l statement 

-o 



hn ► |TxpressiQn"[ -|^ ( THEfT^ — ►[ statemenT] L-» (eLSE) — ►QtaremenT] ff 



-► ( case") — ► [expression [ -►(o^ -r ^ constant ) ^C0~^ 



-»^WHILE^— ►[Expression [ — ►(do) — ►[ statement [• 





1 — 1^ 1 expression | — ^^pQ^ ^ statement \ - 



TH) 3->j variable | L^^o)— ^ j statement "[ - 



-►( goto") — ►! unsigned integer] 



BLOCK 

■*• r» ( LABEL ) j 



-*[ 



unsigned integer] 



-<D-^ 

► (const) — y-> | Identifier [ -»(j-^)—» | constant [ - 

1 c> 




-(TW- I block ! ■< (?)♦ 



■(PROCEDUR^»] Identifier | — ►[ parameter list [- 



. ^FUNCTIofv^ identn"iBi) -»> ) parameter list [ »fTVH^ 
tatemen 



' begin) — T — H statemenT^ 1 — » (eNd) - 



COMPILATION 



■♦ (PRO0RAM )-» |identHiei| -»( I )-j>j]demi(ie^] 1*( ) )-*(T)- 



h- 






J~i 



■O-^ 



-o 



DASHED LINES I 1 ARE NOT INCLUDED 

SHADED AREAS REPRESENT UCSD EXTENSIONS 



Page 133 



APPENDIX D 
GL08BARY 



Appendix U Gloss>ary 



ARRAY 



'^'^IS^^. 



^^^»^TW^ 



An ordered arranqement of characters; a PACKED ^^^rY w 



BACKUP FILE 

A copy of a file created for protection in case i^'^rsfe 
destroyed unintentionally. 

BAD BLOCK 

A defective block on a storage medium/ such as « 
a hardware error when attempting to read or i»ritw 

BASE SEGilEHT 

The portion of a segmented program that is alwi||<^ 

BLCCK '" 

A group of characters or bytes transmitted as « i^^ 
of 512 bytes. 

BOOLEAN VARIABLE .,' 

A variable uthich* (Bhen evaluated/ produces- tJ^^^W^^^. 
result. 

BOOTSTRAP 

A routine whose first instructions are suffici#«^ 
of the routine into memory from an input d«vic»# ' 
a complex system of programs. •.'* 

BREAKPOINT 

A program point indicated by a breakpoint i«*trMC 
inserted by the Compiler to interrupt the propr#« 
can be checked before continuing to compietiawi t%/. 




Page 135 



BUf-l"ER 

A 5tora.ge area used to hold information temporarily mhen it is beinci 
transferred betiueen tiuo devices or between a device <ji)d roemcry.; often 
a specially designated area of memory. 

CODE FILE 

A file containing code to be executed.; has the suffix of ".CtS)E". 

C0i1i1AND or COriHAND NAilE 

A ujord; mnemonic or character* by virtue of its syntax in a line of 
inputs causes a predefined operation to be performed. 

CCB1I1AND STRING 

A line of input that includes, generally, a command, one or more 
file specifications, and optional qualifiers. 

COI-JPILE 

The production of binary code (machine-readable) from symbolic 
instructions mritten in a high-level language. 

C011PILER 

Translates high-level languape (Pascal or Basci) into machine code. 

CONFIGURATION 

A particular selection of hardware devices or software routines or 
programs that function together. 

CONSOLE 

The terminal that acts as the primary interface between the computer 
operator/user and the system; used to initiate and direct ovorail 
system operation,, 

CONST ANf 

A value that remains the same throughout a distinct operation; as 
cojopared to a variable. 

C0N1R0L CHARACTER 

Controls an action rather that passing on data to a program. 

CREATE 

To open, write data to, and close a file for the first time,. 

DATA FILE 

A file containing dato to be manipulated by a program. 

DEBUGGING 

Searching for, and eliminating, sources of error (bugs) in a program.. 

DEFAOIT 

The value of an argument, operand or field assumed by a program if a 
specific assignm<?nt is not specified by the user. 

DEVICE 

A hardware unit such aii an I/O peripheral (e.g., disk, video terminal), 

P<3ge 136 



the physical unit as opposed to VOLUHE^ the lotjical unit, 

DIRECTORY 

A table that contain!* the names of/ and pointers to> files on a masE- 
storape devi cc» 

DISASSEMBLER 

A propram that translates object code back to source statements » 

EXPRFSSIt»>l 

A combination of commands and operands that can be evaluated to a 
distinct result. 

FILE 

A logical collection of data treated as a unit; may be tt'ork* code. 
text> foto or data file. 

FILE SPECIFICATION 

A name that identifies uniquely a file maintained in any system.; 

must contain/ at a minimumi the file name; may also contain the volume 

number and name. 

FUNCTION 

A routine that returns a value. 

HEXADECIIIAL 

Whole numbers in positional notation usin(j 16 as a base. 

HIGH LEVEL LANGUAGE 

A problem-oriented language rather that a machine -oriented one. 

INITIALIZE 

Setting all hardware and softu>are controls to starting valuer* at the 
beginning of a neu) program. 

INTERRUPT 

The suspension of the normal programming routine to handle a sudden 
request for service. After completion of interrupt service* the 
program is resumed where it left off. 

KEYBOARD ENTRY DEVICE 

A device with a keybord <e.Q./ teletypesuriter* video terminal) used 
by the system operator to control the system; CONSOLE. 

LIBRARY 

A collection of programs or subprograms contained as segmentfi in 

a library file; normally contains frequently needed routines that may 

be accessed by other programs. 

LISTING 

A hard copy .generated by a line printer. 

LITERAL 

The explicit representation of character strings. 

Pago 137 



IJW) 

To store a program or date in memorij, 

i..og;ical DFViCF mm. 

An alphanumeric name a!^5:i,gned by the user to represent a phycical 
device.; used synonymously luitn the phy&ical device name/number xn the 
logical program.. 

I1ALII1NL' LAMCUAIvF: 

Instructions in binary code that can be operated on by the computer; 
as compared tuith hiQb- level languages that can be read and understood 
by the v&ei „ 

A set of storage locations connected directly to the procesEor. 

Routines enclosed mithin larger routines but not necessarily a part 
of the larger; a series of looping instructions may be nestf?d. 

OBviFCT CllDE 

Relocatable machine- Ian tjuage codPu 

OBdl-CT PROGRAn 

The source language program after it has been translated into machine 
language^ output of the Compiler. 

ONHINf 

Equipment and devices directly connected to> and controlled by, the 
central processing unit, 

OVERLAY SEGHEHT 

A segment of code treated as a unit that can overlay rode alr«>ady in 
memory ar^d be overlaid by other segments,, 

OMERIAY STRUCTURE 

An overlay system consisting of a root segment and, optionally, one 
or more overlay segment^-, 

PACK 

To compress data in storage,. 

PROCEDURE 

A routine that does not return a value,. 

QUA) TFIER 

A parameter specified in a comnand string that modifies some other 
parameter., 

SOURCE LAMGUAGE 

A system of symbols and syntax easily understood by people that is 
used to describe a procedure that a computer can execute. 



'age 138 



STACK 

A block of successive memory locations accessible from one end on a 
LIFO basis (last-in -first-out), 

SUBSCRIPT 

A numerically valued expression or expression element that is appended 
to a variable name to uniquely identify elements of an an tjy. 

SWAPPING 

Copying areas of memory to mass storage and back in order to use the 
memory for tiuo or more purposes.. 

UTILITY 

Any general-purpose program included in an operating system to perform 
common functions. 

VARIABLE 

The symbolic representation of a logical storage location that can 
contain a value that changes during a discrete processing operation.. 
as compared to constant. 



Page 139 




3128 REDHILL AVENUE, BOX 2180 
NEWPORT BEACH, CA 92663 
(714) 557-3550, TWX 910-595-1139 



PRINTED IN USA.